From do-not-reply at jboss.org Fri Oct 1 03:20:13 2010
Content-Type: multipart/mixed; boundary="===============0982080440701988258=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3228 -
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup.
Date: Fri, 01 Oct 2010 03:20:12 -0400
Message-ID: <201010010720.o917KCvC028326@svn01.web.mwc.hst.phx2.redhat.com>
--===============0982080440701988258==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: areshetnyak
Date: 2010-10-01 03:20:11 -0400 (Fri, 01 Oct 2010)
New Revision: 3228
Modified:
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/=
modules/jcr/backup/exojcr-backup-service.xml
Log:
EXOJCR-747 : Make backup restore easier documentation.
Modified: jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook=
/en-US/modules/jcr/backup/exojcr-backup-service.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US=
/modules/jcr/backup/exojcr-backup-service.xml 2010-09-30 15:29:38 UTC (rev =
3227)
+++ jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US=
/modules/jcr/backup/exojcr-backup-service.xml 2010-10-01 07:20:11 UTC (rev =
3228)
@@ -478,9 +478,15 @@
Restore existing workspace or repository
=
+
+ Restore of existing workspace or repository will be available =
from
+ JCR 1.14.0-CR1.
+
+
Restore of existed system workspace was not supported. When ne=
ed
- restore of system workspace, than we need restore all repository.
+ restore of system workspace, than we need restore full
+ repository.
=
The resore of existed workspace or repositry is avaleble.
--===============0982080440701988258==--
From do-not-reply at jboss.org Fri Oct 1 05:05:09 2010
Content-Type: multipart/mixed; boundary="===============5516755832324090677=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3229 -
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version.
Date: Fri, 01 Oct 2010 05:05:09 -0400
Message-ID: <201010010905.o91959Nf012598@svn01.web.mwc.hst.phx2.redhat.com>
--===============5516755832324090677==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: tolusha
Date: 2010-10-01 05:05:08 -0400 (Fri, 01 Oct 2010)
New Revision: 3229
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/=
jcr/impl/core/version/ItemDataRestoreVisitor.java
Log:
EXOJCR-961: remain node only for versionable node and OnParentVersionAction=
is VERSION for other cases all works accordingly to spec
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/se=
rvices/jcr/impl/core/version/ItemDataRestoreVisitor.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services=
/jcr/impl/core/version/ItemDataRestoreVisitor.java 2010-10-01 07:20:11 UTC =
(rev 3228)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services=
/jcr/impl/core/version/ItemDataRestoreVisitor.java 2010-10-01 09:05:08 UTC =
(rev 3229)
@@ -199,11 +199,7 @@
nodeTypeDataManager.getChildNodeDefinition(node.getQPath().=
getName(), parent.getPrimaryTypeName(),
parent.getMixinTypeNames()).getOnParentVersion();
=
- // ItemDataCopyIgnoredVisitory
- if (onParentVersion !=3D OnParentVersionAction.COPY
- && onParentVersion !=3D OnParentVersionAction.VERSION
- && onParentVersion !=3D OnParentVersionAction.IGNORE
- || onParentVersion =3D=3D OnParentVersionAction.VERSION
+ if (onParentVersion =3D=3D OnParentVersionAction.VERSION
&& nodeTypeDataManager.isNodeType(Constants.MIX_VERSIONABLE=
, node.getPrimaryTypeName(),
node.getMixinTypeNames()))
{
--===============5516755832324090677==--
From do-not-reply at jboss.org Fri Oct 1 05:12:12 2010
Content-Type: multipart/mixed; boundary="===============9177543159759156077=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3230 -
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup.
Date: Fri, 01 Oct 2010 05:12:12 -0400
Message-ID: <201010010912.o919CCQV012830@svn01.web.mwc.hst.phx2.redhat.com>
--===============9177543159759156077==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: tolusha
Date: 2010-10-01 05:12:11 -0400 (Fri, 01 Oct 2010)
New Revision: 3230
Modified:
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/=
modules/jcr/backup/exojcr-backup-service.xml
Log:
EXOJCR-747: fix doc
Modified: jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook=
/en-US/modules/jcr/backup/exojcr-backup-service.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US=
/modules/jcr/backup/exojcr-backup-service.xml 2010-10-01 09:05:08 UTC (rev =
3229)
+++ jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US=
/modules/jcr/backup/exojcr-backup-service.xml 2010-10-01 09:12:11 UTC (rev =
3230)
@@ -6,6 +6,11 @@
=
eXo JCR Backup Service
=
+
+ Restore of system workspace is not supported only as part of
+ restoring of whole repository.
+
+
Concept
=
@@ -479,16 +484,10 @@
Restore existing workspace or repository
=
- Restore of existing workspace or repository will be available =
from
- JCR 1.14.0-CR1.
+ Restoring of existing workspace or repository available from J=
CR
+ 1.14.0-CR1.
=
-
- Restore of existed system workspace was not supported. When ne=
ed
- restore of system workspace, than we need restore full
- repository.
-
-
The resore of existed workspace or repositry is avaleble.
=
For restore will be used spacial methods:
--===============9177543159759156077==--
From do-not-reply at jboss.org Fri Oct 1 06:14:43 2010
Content-Type: multipart/mixed; boundary="===============3040729238034492070=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3231 - in
jcr/trunk/exo.jcr.component.webdav/src:
test/java/org/exoplatform/services/jcr/webdav/command and 1 other
directories.
Date: Fri, 01 Oct 2010 06:14:43 -0400
Message-ID: <201010011014.o91AEhlg021540@svn01.web.mwc.hst.phx2.redhat.com>
--===============3040729238034492070==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: nzamosenchuk
Date: 2010-10-01 06:14:43 -0400 (Fri, 01 Oct 2010)
New Revision: 3231
Added:
jcr/trunk/exo.jcr.component.webdav/src/test/resources/rh_nodetype.xml
jcr/trunk/exo.jcr.component.webdav/src/test/resources/test.txt
Modified:
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/service=
s/jcr/webdav/resource/FileResource.java
jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/service=
s/jcr/webdav/command/TestGet.java
Log:
EXOJCR-956 : Returning creation date if last modified date is missing.
Modified: jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/=
services/jcr/webdav/resource/FileResource.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/servic=
es/jcr/webdav/resource/FileResource.java 2010-10-01 09:12:11 UTC (rev 3230)
+++ jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/servic=
es/jcr/webdav/resource/FileResource.java 2010-10-01 10:14:43 UTC (rev 3231)
@@ -222,7 +222,15 @@
}
else if (name.equals(GETLASTMODIFIED))
{
- Calendar modified =3D contentNode().getProperty("jcr:lastModified=
").getDate();
+ Calendar modified;
+ try
+ {
+ modified =3D contentNode().getProperty("jcr:lastModified").get=
Date();
+ }
+ catch (PathNotFoundException e)
+ {
+ modified =3D node.getProperty("jcr:created").getDate();
+ }
HierarchicalProperty lastModified =3D new HierarchicalProperty(na=
me, modified, MODIFICATION_PATTERN);
lastModified.setAttribute("b:dt", "dateTime.rfc1123");
return lastModified;
@@ -268,7 +276,9 @@
return lockDiscovery(token, owner, "86400");
}
else
+ {
throw new PathNotFoundException();
+ }
}
else if (name.equals(ISVERSIONED))
{
Modified: jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/=
services/jcr/webdav/command/TestGet.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/servic=
es/jcr/webdav/command/TestGet.java 2010-10-01 09:12:11 UTC (rev 3230)
+++ jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/servic=
es/jcr/webdav/command/TestGet.java 2010-10-01 10:14:43 UTC (rev 3231)
@@ -19,18 +19,28 @@
package org.exoplatform.services.jcr.webdav.command;
=
import org.exoplatform.common.http.HTTPStatus;
+import org.exoplatform.services.jcr.core.nodetype.ExtendedNodeTypeManager;
+import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
+import org.exoplatform.services.jcr.impl.core.version.VersionImpl;
import org.exoplatform.services.jcr.webdav.BaseStandaloneTest;
import org.exoplatform.services.jcr.webdav.WebDavConstants.WebDAVMethods;
import org.exoplatform.services.jcr.webdav.utils.TestUtils;
+import org.exoplatform.services.rest.ext.provider.XSLTStreamingOutput;
import org.exoplatform.services.rest.impl.ContainerResponse;
=
import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringWriter;
+import java.util.Calendar;
=
+import javax.jcr.Node;
+
/**
* Created by The eXo Platform SAS Author : Dmytro Katayev
* work.visor.ck(a)gmail.com Aug 13, 2008
@@ -59,17 +69,61 @@
StringWriter sw =3D new StringWriter();
char[] buffer =3D new char[1024];
for (int n; (n =3D r.read(buffer)) !=3D -1;)
+ {
sw.write(buffer, 0, n);
+ }
String str =3D sw.toString();
assertEquals(fileContent, str);
}
- =
+
public void testNotFoundGet() throws Exception
{
ContainerResponse response =3D service(WebDAVMethods.GET, getPathWS(=
) + "/not-found" + path, "", null, null);
assertEquals(HTTPStatus.NOT_FOUND, response.getStatus());
}
=
+ /**
+ * Details can be found here: https://jira.jboss.org/browse/EXOJCR-956
+ * @throws Exception
+ */
+ public void testMissingJcrLastModifiedProperty() throws Exception
+ {
+ File file =3D new File("src/test/resources/rh_nodetype.xml");
+ assertTrue("src/test/resources/rh_nodetype.xml not found", file.exis=
ts());
+ FileInputStream fis =3D new FileInputStream(file);
+
+ session.getWorkspace().getNamespaceRegistry().registerNamespace("rh"=
, "www.vn.vnn");
+ session.getWorkspace().getNodeTypesHolder().registerNodeTypes(fis, E=
xtendedNodeTypeManager.IGNORE_IF_EXISTS,
+ NodeTypeDataManager.TEXT_XML);
+
+ Node podcast =3D session.getRootNode().addNode("podcast", "rh:podcas=
t");
+
+ Node nodeToAdd =3D podcast.addNode("rh:podcastFile", "nt:file");
+ Node contentNodeOfNodeToAdd =3D nodeToAdd.addNode("jcr:content", "nt=
:resource");
+ contentNodeOfNodeToAdd.setProperty("jcr:data", new FileInputStream("=
src/test/resources/test.txt"));
+ contentNodeOfNodeToAdd.setProperty("jcr:mimeType", "text/plain");
+ contentNodeOfNodeToAdd.setProperty("jcr:lastModified", Calendar.getI=
nstance());
+ session.save();
+
+ podcast.addMixin("mix:versionable");
+ session.save();
+
+ VersionImpl v =3D (VersionImpl)podcast.checkin();
+ session.save();
+
+ podcast.checkout();
+ session.save();
+
+ String path =3D
+ getPathWS() + "/jcr:system/jcr:versionStorage/" + v.getContaining=
History().getIdentifier()
+ + "/1/jcr:frozenNode/rh:podcastFile";
+
+ ContainerResponse response =3D service(WebDAVMethods.GET, path, "", =
null, null);
+ assertEquals("Successful result expected (200), but actual is: " + r=
esponse.getStatus(), 200, response
+ .getStatus());
+
+ }
+
@Override
protected String getRepositoryName()
{
Added: jcr/trunk/exo.jcr.component.webdav/src/test/resources/rh_nodetype.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/trunk/exo.jcr.component.webdav/src/test/resources/rh_nodetype.xml =
(rev 0)
+++ jcr/trunk/exo.jcr.component.webdav/src/test/resources/rh_nodetype.xml 2=
010-10-01 10:14:43 UTC (rev 3231)
@@ -0,0 +1,52 @@
+
+
+
+nt:base
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+nt:file
+
+
+
+
+
\ No newline at end of file
Property changes on: jcr/trunk/exo.jcr.component.webdav/src/test/resources/=
rh_nodetype.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jcr/trunk/exo.jcr.component.webdav/src/test/resources/test.txt
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/trunk/exo.jcr.component.webdav/src/test/resources/test.txt =
(rev 0)
+++ jcr/trunk/exo.jcr.component.webdav/src/test/resources/test.txt 2010-10-=
01 10:14:43 UTC (rev 3231)
@@ -0,0 +1,3 @@
+hello =
+its a little text file for server tests
+Here is all right, I suppose :^)
\ No newline at end of file
Property changes on: jcr/trunk/exo.jcr.component.webdav/src/test/resources/=
test.txt
___________________________________________________________________
Name: svn:mime-type
+ text/plain
--===============3040729238034492070==--
From do-not-reply at jboss.org Mon Oct 4 04:34:25 2010
Content-Type: multipart/mixed; boundary="===============1794667923815851624=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3232 - in
jcr/branches/1.12.x/exo.jcr.component.webdav/src:
test/java/org/exoplatform/services/jcr/webdav/command and 1 other
directories.
Date: Mon, 04 Oct 2010 04:34:25 -0400
Message-ID: <201010040834.o948YPA3008823@svn01.web.mwc.hst.phx2.redhat.com>
--===============1794667923815851624==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: nzamosenchuk
Date: 2010-10-04 04:34:24 -0400 (Mon, 04 Oct 2010)
New Revision: 3232
Added:
jcr/branches/1.12.x/exo.jcr.component.webdav/src/test/resources/rh_nodet=
ype.xml
jcr/branches/1.12.x/exo.jcr.component.webdav/src/test/resources/test.txt
Modified:
jcr/branches/1.12.x/exo.jcr.component.webdav/src/main/java/org/exoplatfo=
rm/services/jcr/webdav/resource/FileResource.java
jcr/branches/1.12.x/exo.jcr.component.webdav/src/test/java/org/exoplatfo=
rm/services/jcr/webdav/command/TestGet.java
Log:
JCR-1467: applying the patch
Modified: jcr/branches/1.12.x/exo.jcr.component.webdav/src/main/java/org/ex=
oplatform/services/jcr/webdav/resource/FileResource.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.component.webdav/src/main/java/org/exoplatf=
orm/services/jcr/webdav/resource/FileResource.java 2010-10-01 10:14:43 UTC =
(rev 3231)
+++ jcr/branches/1.12.x/exo.jcr.component.webdav/src/main/java/org/exoplatf=
orm/services/jcr/webdav/resource/FileResource.java 2010-10-04 08:34:24 UTC =
(rev 3232)
@@ -222,7 +222,15 @@
}
else if (name.equals(GETLASTMODIFIED))
{
- Calendar modified =3D contentNode().getProperty("jcr:lastModified=
").getDate();
+ Calendar modified;
+ try
+ {
+ modified =3D contentNode().getProperty("jcr:lastModified").get=
Date();
+ }
+ catch (PathNotFoundException e)
+ {
+ modified =3D node.getProperty("jcr:created").getDate();
+ }
HierarchicalProperty lastModified =3D new HierarchicalProperty(na=
me, modified, MODIFICATION_PATTERN);
lastModified.setAttribute("b:dt", "dateTime.rfc1123");
return lastModified;
@@ -268,7 +276,9 @@
return lockDiscovery(token, owner, "86400");
}
else
+ {
throw new PathNotFoundException();
+ }
}
else if (name.equals(ISVERSIONED))
{
Modified: jcr/branches/1.12.x/exo.jcr.component.webdav/src/test/java/org/ex=
oplatform/services/jcr/webdav/command/TestGet.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.component.webdav/src/test/java/org/exoplatf=
orm/services/jcr/webdav/command/TestGet.java 2010-10-01 10:14:43 UTC (rev 3=
231)
+++ jcr/branches/1.12.x/exo.jcr.component.webdav/src/test/java/org/exoplatf=
orm/services/jcr/webdav/command/TestGet.java 2010-10-04 08:34:24 UTC (rev 3=
232)
@@ -19,18 +19,28 @@
package org.exoplatform.services.jcr.webdav.command;
=
import org.exoplatform.common.http.HTTPStatus;
+import org.exoplatform.services.jcr.core.nodetype.ExtendedNodeTypeManager;
+import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
+import org.exoplatform.services.jcr.impl.core.version.VersionImpl;
import org.exoplatform.services.jcr.webdav.BaseStandaloneTest;
import org.exoplatform.services.jcr.webdav.WebDavConstants.WebDAVMethods;
import org.exoplatform.services.jcr.webdav.utils.TestUtils;
+import org.exoplatform.services.rest.ext.provider.XSLTStreamingOutput;
import org.exoplatform.services.rest.impl.ContainerResponse;
=
import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringWriter;
+import java.util.Calendar;
=
+import javax.jcr.Node;
+
/**
* Created by The eXo Platform SAS Author : Dmytro Katayev
* work.visor.ck(a)gmail.com Aug 13, 2008
@@ -59,17 +69,61 @@
StringWriter sw =3D new StringWriter();
char[] buffer =3D new char[1024];
for (int n; (n =3D r.read(buffer)) !=3D -1;)
+ {
sw.write(buffer, 0, n);
+ }
String str =3D sw.toString();
assertEquals(fileContent, str);
}
- =
+
public void testNotFoundGet() throws Exception
{
ContainerResponse response =3D service(WebDAVMethods.GET, getPathWS(=
) + "/not-found" + path, "", null, null);
assertEquals(HTTPStatus.NOT_FOUND, response.getStatus());
}
=
+ /**
+ * Details can be found here: https://jira.jboss.org/browse/EXOJCR-956
+ * @throws Exception
+ */
+ public void testMissingJcrLastModifiedProperty() throws Exception
+ {
+ File file =3D new File("src/test/resources/rh_nodetype.xml");
+ assertTrue("src/test/resources/rh_nodetype.xml not found", file.exis=
ts());
+ FileInputStream fis =3D new FileInputStream(file);
+
+ session.getWorkspace().getNamespaceRegistry().registerNamespace("rh"=
, "www.vn.vnn");
+ session.getWorkspace().getNodeTypesHolder().registerNodeTypes(fis, E=
xtendedNodeTypeManager.IGNORE_IF_EXISTS,
+ NodeTypeDataManager.TEXT_XML);
+
+ Node podcast =3D session.getRootNode().addNode("podcast", "rh:podcas=
t");
+
+ Node nodeToAdd =3D podcast.addNode("rh:podcastFile", "nt:file");
+ Node contentNodeOfNodeToAdd =3D nodeToAdd.addNode("jcr:content", "nt=
:resource");
+ contentNodeOfNodeToAdd.setProperty("jcr:data", new FileInputStream("=
src/test/resources/test.txt"));
+ contentNodeOfNodeToAdd.setProperty("jcr:mimeType", "text/plain");
+ contentNodeOfNodeToAdd.setProperty("jcr:lastModified", Calendar.getI=
nstance());
+ session.save();
+
+ podcast.addMixin("mix:versionable");
+ session.save();
+
+ VersionImpl v =3D (VersionImpl)podcast.checkin();
+ session.save();
+
+ podcast.checkout();
+ session.save();
+
+ String path =3D
+ getPathWS() + "/jcr:system/jcr:versionStorage/" + v.getContaining=
History().getIdentifier()
+ + "/1/jcr:frozenNode/rh:podcastFile";
+
+ ContainerResponse response =3D service(WebDAVMethods.GET, path, "", =
null, null);
+ assertEquals("Successful result expected (200), but actual is: " + r=
esponse.getStatus(), 200, response
+ .getStatus());
+
+ }
+
@Override
protected String getRepositoryName()
{
Added: jcr/branches/1.12.x/exo.jcr.component.webdav/src/test/resources/rh_n=
odetype.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.component.webdav/src/test/resources/rh_node=
type.xml (rev 0)
+++ jcr/branches/1.12.x/exo.jcr.component.webdav/src/test/resources/rh_node=
type.xml 2010-10-04 08:34:24 UTC (rev 3232)
@@ -0,0 +1,52 @@
+
+
+
+nt:base
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+nt:file
+
+
+
+
+
\ No newline at end of file
Property changes on: jcr/branches/1.12.x/exo.jcr.component.webdav/src/test/=
resources/rh_nodetype.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jcr/branches/1.12.x/exo.jcr.component.webdav/src/test/resources/test=
.txt
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.component.webdav/src/test/resources/test.tx=
t (rev 0)
+++ jcr/branches/1.12.x/exo.jcr.component.webdav/src/test/resources/test.tx=
t 2010-10-04 08:34:24 UTC (rev 3232)
@@ -0,0 +1,3 @@
+hello =
+its a little text file for server tests
+Here is all right, I suppose :^)
\ No newline at end of file
Property changes on: jcr/branches/1.12.x/exo.jcr.component.webdav/src/test/=
resources/test.txt
___________________________________________________________________
Name: svn:mime-type
+ text/plain
--===============1794667923815851624==--
From do-not-reply at jboss.org Mon Oct 4 06:38:01 2010
Content-Type: multipart/mixed; boundary="===============5452106933295453780=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3233 - jcr/tags/1.14.0-Beta02.
Date: Mon, 04 Oct 2010 06:38:01 -0400
Message-ID: <201010041038.o94Ac1ZK026262@svn01.web.mwc.hst.phx2.redhat.com>
--===============5452106933295453780==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: tolusha
Date: 2010-10-04 06:38:01 -0400 (Mon, 04 Oct 2010)
New Revision: 3233
Modified:
jcr/tags/1.14.0-Beta02/pom.xml
Log:
[maven-release-plugin] prepare branch 1.14-CNK
Modified: jcr/tags/1.14.0-Beta02/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/tags/1.14.0-Beta02/pom.xml 2010-10-04 08:34:24 UTC (rev 3232)
+++ jcr/tags/1.14.0-Beta02/pom.xml 2010-10-04 10:38:01 UTC (rev 3233)
@@ -34,9 +34,9 @@
eXo JCR
=
- scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/jcr/tags/1.=
14.0-Beta02
- scm:svn:https://svn.jboss.org/repos/exo-jcr/jcr/t=
ags/1.14.0-Beta02
- http://fisheye.jboss.org/browse/exo-jcr/jcr/tags/1.14.0-Beta02
+ scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/jcr/branche=
s/1.14-CNK
+ scm:svn:https://svn.jboss.org/repos/exo-jcr/jcr/b=
ranches/1.14-CNK
+ http://fisheye.jboss.org/browse/exo-jcr/jcr/branches/1.14-CNK
=
--===============5452106933295453780==--
From do-not-reply at jboss.org Mon Oct 4 06:38:19 2010
Content-Type: multipart/mixed; boundary="===============0108486488028965454=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3234 - in jcr/branches: 1.14-CNK and
1 other directory.
Date: Mon, 04 Oct 2010 06:38:19 -0400
Message-ID: <201010041038.o94AcJp0026273@svn01.web.mwc.hst.phx2.redhat.com>
--===============0108486488028965454==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: tolusha
Date: 2010-10-04 06:38:19 -0400 (Mon, 04 Oct 2010)
New Revision: 3234
Added:
jcr/branches/1.14-CNK/
jcr/branches/1.14-CNK/pom.xml
Removed:
jcr/branches/1.14-CNK/pom.xml
Log:
[maven-release-plugin] copy for branch 1.14-CNK
Copied: jcr/branches/1.14-CNK (from rev 3232, jcr/tags/1.14.0-Beta02)
Deleted: jcr/branches/1.14-CNK/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/tags/1.14.0-Beta02/pom.xml 2010-10-04 08:34:24 UTC (rev 3232)
+++ jcr/branches/1.14-CNK/pom.xml 2010-10-04 10:38:19 UTC (rev 3234)
@@ -1,471 +0,0 @@
-
-
-
- 4.0.0
-
- org.exoplatform
- foundation-parent
- 7
-
-
- org.exoplatform.jcr
- jcr-parent
- 1.14.0-Beta02
- pom
- eXo JCR
-
-
- scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/jcr/tags/1.=
14.0-Beta02
- scm:svn:https://svn.jboss.org/repos/exo-jcr/jcr/t=
ags/1.14.0-Beta02
- http://fisheye.jboss.org/browse/exo-jcr/jcr/tags/1.14.0-Beta02
-
-
-
- exo-jcr
- 1.14
- 2.3.0-Beta02
- 2.4.0-Beta02
- 2.2.0-Beta02
- 1
-
-
-
-
-
- org.exoplatform.kernel
- exo.kernel.commons
- ${org.exoplatform.kernel.version}
-
-
- org.exoplatform.kernel
- exo.kernel.commons.test
- ${org.exoplatform.kernel.version}
-
-
- org.exoplatform.kernel
- exo.kernel.component.command
- ${org.exoplatform.kernel.version}
-
-
- org.exoplatform.kernel
- exo.kernel.container
- ${org.exoplatform.kernel.version}
-
-
- org.exoplatform.kernel
- exo.kernel.component.common
- ${org.exoplatform.kernel.version}
-
-
- org.exoplatform.kernel
- exo.kernel.component.cache
- ${org.exoplatform.kernel.version}
-
-
- org.exoplatform.core
- exo.core.component.document
- ${org.exoplatform.core.version}
-
-
- org.exoplatform.core
- exo.core.component.organization.api
- ${org.exoplatform.core.version}
-
-
- org.exoplatform.core
- exo.core.component.security.core
- ${org.exoplatform.core.version}
-
-
- org.exoplatform.core
- exo.core.component.script.groovy
- ${org.exoplatform.core.version}
-
-
- org.exoplatform.ws
- exo.ws.rest.core
- ${org.exoplatform.ws.version}
-
-
- org.exoplatform.ws
- exo.ws.rest.ext
- ${org.exoplatform.ws.version}
-
-
- org.exoplatform.ws
- exo.ws.commons
- ${org.exoplatform.ws.version}
-
-
- org.exoplatform.ws
- exo.ws.frameworks.json
- ${org.exoplatform.ws.version}
-
-
- org.exoplatform.ws
- exo.ws.frameworks.servlet
- ${org.exoplatform.ws.version}
-
-
- org.exoplatform.jcr
- exo.jcr.component.ext
- ${project.version}
-
-
- org.exoplatform.jcr
- exo.jcr.component.core
- ${project.version}
-
-
- org.exoplatform.jcr
- exo.jcr.framework.command
- ${project.version}
-
-
- org.exoplatform.jcr
- exo.jcr.component.ftp
- ${project.version}
-
-
- org.exoplatform.jcr
- exo.jcr.component.webdav
- ${project.version}
-
-
- org.exoplatform.jcr
- exo.jcr.framework.web
- ${project.version}
-
-
- org.exoplatform.jcr
- exo.jcr.framework.ftpclient
- ${project.version}
-
-
- org.exoplatform.jcr
- exo.jcr.cluster.testclient
- ${project.version}
-
-
- org.exoplatform.jcr
- exo.jcr.applications.fckeditor
- ${project.version}
- war
-
-
- org.exoplatform.jcr
- exo.jcr.applications.browser
- ${project.version}
- war
-
-
- org.exoplatform.jcr
- exo.jcr.applications.rest
- ${project.version}
- war
-
-
- org.exoplatform.jcr
- exo.jcr.connectors.localadapter
- rar
- ${project.version}
-
-
- commons-lang
- commons-lang
- 2.4
-
-
- commons-chain
- commons-chain
- 1.0
-
-
- org.jibx
- jibx-run
- 1.2.1
-
-
- picocontainer
- picocontainer
- 1.1
-
-
- xml-apis
- xml-apis
- 1.0.b2
-
-
- org.slf4j
- slf4j-api
- 1.5.8
-
-
- org.slf4j
- slf4j-log4j12
- 1.5.8
- =
-
- stax
- stax-api
- 1.0.1
-
-
- javax.jcr
- jcr
- 1.0
-
-
- javax.servlet
- servlet-api
- 2.4
-
-
- javax.annotation
- jsr250-api
- 1.0
-
-
- javax.ws.rs
- jsr311-api
- 1.0
-
-
- javax.transaction
- jta
- 1.0.1B
-
-
- javax.resource
- connector-api
- 1.5
-
-
- jtidy
- jtidy
- 4aug2000r7-dev
-
-
- org.apache.lucene
- lucene-core
- 2.4.1
-
-
- org.apache.lucene
- lucene-spellchecker
- 2.4.1
-
-
- org.apache.lucene
- lucene-memory
- 2.4.1
-
-
- com.sun.xml.stream
- sjsxp
- 1.0
-
-
- commons-dbcp
- commons-dbcp
- 1.2.2
-
-
- commons-pool
- commons-pool
-
-
-
-
- commons-pool
- commons-pool
- 1.5.4
-
-
- commons-beanutils
- commons-beanutils
- 1.8.0
-
-
- commons-logging
- commons-logging
- 1.1
-
-
- javax.xml.stream
- stax-api
- 1.0
- =
-
- xpp3
- xpp3
- 1.1.3.4.O
- =
-
- concurrent
- concurrent
- 1.3.4
-
-
- commons-collections
- commons-collections
- 3.2
-
-
- org.apache.ws.commons
- ws-commons-util
- 1.0.1
-
-
- org.apache.jackrabbit
- jackrabbit-jcr-tests
- 1.6.0
- sources
-
-
- hsqldb
- hsqldb
- 1.8.0.7
-
-
- jgroups
- jgroups
- 2.6.13.GA
-
-
- commons-fileupload
- commons-fileupload
- 1.2.1
-
-
- com.sun.xml.bind
- jaxb-impl
- 2.1.7
-
-
- javax.resource
- connector
- 1.5
-
-
- commons-io
- commons-io
- 1.3
-
-
- org.jboss.cache
- jbosscache-core
- 3.2.6.GA
-
-
- jboss.jbossts
- jbossjts
- 4.6.1.GA
-
-
- jboss.jbossts
- jbossts-common
- 4.6.1.GA
-
-
- org.aspectj
- aspectjrt
- 1.6.8
- =
-
-
-
-
- junit
- junit
- test
-
-
- org.slf4j
- slf4j-log4j12
- test
- =
-
-
-
-
- src/main/java
-
- **/*.xml
- **/*.xsl
- **/*.properties
- **/*.ion
- **/*.conf
- **/*.config
-
-
-
- src/main/resources
-
- **/*.xml
- **/*.xsl
- **/*.properties
- **/login.conf
- **/*.ion
- **/*.conf
- **/*.config
-
-
-
-
-
- src/test/java
-
- **/*.properties
- **/*.xml
- **/*.txt
- **/*.conf
- **/*.config
-
-
-
- src/test/resources
-
- **/*.properties
- **/*.xml
- **/*.txt
- **/*.conf
- **/*.config
-
-
-
-
-
- exo.jcr.component.core
- exo.jcr.component.statistics
- exo.jcr.component.ext
- exo.jcr.component.ftp
- exo.jcr.component.webdav
- exo.jcr.connectors.localadapter
- exo.jcr.framework.command
- exo.jcr.framework.web
- exo.jcr.framework.ftpclient
- applications
- exo.jcr.docs
- packaging/module
-
-
Copied: jcr/branches/1.14-CNK/pom.xml (from rev 3233, jcr/tags/1.14.0-Beta0=
2/pom.xml)
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/pom.xml (rev 0)
+++ jcr/branches/1.14-CNK/pom.xml 2010-10-04 10:38:19 UTC (rev 3234)
@@ -0,0 +1,471 @@
+
+
+
+ 4.0.0
+
+ org.exoplatform
+ foundation-parent
+ 7
+
+
+ org.exoplatform.jcr
+ jcr-parent
+ 1.14.0-Beta02
+ pom
+ eXo JCR
+
+
+ scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/jcr/branche=
s/1.14-CNK
+ scm:svn:https://svn.jboss.org/repos/exo-jcr/jcr/b=
ranches/1.14-CNK
+ http://fisheye.jboss.org/browse/exo-jcr/jcr/branches/1.14-CNK
+
+
+
+ exo-jcr
+ 1.14
+ 2.3.0-Beta02
+ 2.4.0-Beta02
+ 2.2.0-Beta02
+ 1
+
+
+
+
+
+ org.exoplatform.kernel
+ exo.kernel.commons
+ ${org.exoplatform.kernel.version}
+
+
+ org.exoplatform.kernel
+ exo.kernel.commons.test
+ ${org.exoplatform.kernel.version}
+
+
+ org.exoplatform.kernel
+ exo.kernel.component.command
+ ${org.exoplatform.kernel.version}
+
+
+ org.exoplatform.kernel
+ exo.kernel.container
+ ${org.exoplatform.kernel.version}
+
+
+ org.exoplatform.kernel
+ exo.kernel.component.common
+ ${org.exoplatform.kernel.version}
+
+
+ org.exoplatform.kernel
+ exo.kernel.component.cache
+ ${org.exoplatform.kernel.version}
+
+
+ org.exoplatform.core
+ exo.core.component.document
+ ${org.exoplatform.core.version}
+
+
+ org.exoplatform.core
+ exo.core.component.organization.api
+ ${org.exoplatform.core.version}
+
+
+ org.exoplatform.core
+ exo.core.component.security.core
+ ${org.exoplatform.core.version}
+
+
+ org.exoplatform.core
+ exo.core.component.script.groovy
+ ${org.exoplatform.core.version}
+
+
+ org.exoplatform.ws
+ exo.ws.rest.core
+ ${org.exoplatform.ws.version}
+
+
+ org.exoplatform.ws
+ exo.ws.rest.ext
+ ${org.exoplatform.ws.version}
+
+
+ org.exoplatform.ws
+ exo.ws.commons
+ ${org.exoplatform.ws.version}
+
+
+ org.exoplatform.ws
+ exo.ws.frameworks.json
+ ${org.exoplatform.ws.version}
+
+
+ org.exoplatform.ws
+ exo.ws.frameworks.servlet
+ ${org.exoplatform.ws.version}
+
+
+ org.exoplatform.jcr
+ exo.jcr.component.ext
+ ${project.version}
+
+
+ org.exoplatform.jcr
+ exo.jcr.component.core
+ ${project.version}
+
+
+ org.exoplatform.jcr
+ exo.jcr.framework.command
+ ${project.version}
+
+
+ org.exoplatform.jcr
+ exo.jcr.component.ftp
+ ${project.version}
+
+
+ org.exoplatform.jcr
+ exo.jcr.component.webdav
+ ${project.version}
+
+
+ org.exoplatform.jcr
+ exo.jcr.framework.web
+ ${project.version}
+
+
+ org.exoplatform.jcr
+ exo.jcr.framework.ftpclient
+ ${project.version}
+
+
+ org.exoplatform.jcr
+ exo.jcr.cluster.testclient
+ ${project.version}
+
+
+ org.exoplatform.jcr
+ exo.jcr.applications.fckeditor
+ ${project.version}
+ war
+
+
+ org.exoplatform.jcr
+ exo.jcr.applications.browser
+ ${project.version}
+ war
+
+
+ org.exoplatform.jcr
+ exo.jcr.applications.rest
+ ${project.version}
+ war
+
+
+ org.exoplatform.jcr
+ exo.jcr.connectors.localadapter
+ rar
+ ${project.version}
+
+
+ commons-lang
+ commons-lang
+ 2.4
+
+
+ commons-chain
+ commons-chain
+ 1.0
+
+
+ org.jibx
+ jibx-run
+ 1.2.1
+
+
+ picocontainer
+ picocontainer
+ 1.1
+
+
+ xml-apis
+ xml-apis
+ 1.0.b2
+
+
+ org.slf4j
+ slf4j-api
+ 1.5.8
+
+
+ org.slf4j
+ slf4j-log4j12
+ 1.5.8
+ =
+
+ stax
+ stax-api
+ 1.0.1
+
+
+ javax.jcr
+ jcr
+ 1.0
+
+
+ javax.servlet
+ servlet-api
+ 2.4
+
+
+ javax.annotation
+ jsr250-api
+ 1.0
+
+
+ javax.ws.rs
+ jsr311-api
+ 1.0
+
+
+ javax.transaction
+ jta
+ 1.0.1B
+
+
+ javax.resource
+ connector-api
+ 1.5
+
+
+ jtidy
+ jtidy
+ 4aug2000r7-dev
+
+
+ org.apache.lucene
+ lucene-core
+ 2.4.1
+
+
+ org.apache.lucene
+ lucene-spellchecker
+ 2.4.1
+
+
+ org.apache.lucene
+ lucene-memory
+ 2.4.1
+
+
+ com.sun.xml.stream
+ sjsxp
+ 1.0
+
+
+ commons-dbcp
+ commons-dbcp
+ 1.2.2
+
+
+ commons-pool
+ commons-pool
+
+
+
+
+ commons-pool
+ commons-pool
+ 1.5.4
+
+
+ commons-beanutils
+ commons-beanutils
+ 1.8.0
+
+
+ commons-logging
+ commons-logging
+ 1.1
+
+
+ javax.xml.stream
+ stax-api
+ 1.0
+ =
+
+ xpp3
+ xpp3
+ 1.1.3.4.O
+ =
+
+ concurrent
+ concurrent
+ 1.3.4
+
+
+ commons-collections
+ commons-collections
+ 3.2
+
+
+ org.apache.ws.commons
+ ws-commons-util
+ 1.0.1
+
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-tests
+ 1.6.0
+ sources
+
+
+ hsqldb
+ hsqldb
+ 1.8.0.7
+
+
+ jgroups
+ jgroups
+ 2.6.13.GA
+
+
+ commons-fileupload
+ commons-fileupload
+ 1.2.1
+
+
+ com.sun.xml.bind
+ jaxb-impl
+ 2.1.7
+
+
+ javax.resource
+ connector
+ 1.5
+
+
+ commons-io
+ commons-io
+ 1.3
+
+
+ org.jboss.cache
+ jbosscache-core
+ 3.2.6.GA
+
+
+ jboss.jbossts
+ jbossjts
+ 4.6.1.GA
+
+
+ jboss.jbossts
+ jbossts-common
+ 4.6.1.GA
+
+
+ org.aspectj
+ aspectjrt
+ 1.6.8
+ =
+
+
+
+
+ junit
+ junit
+ test
+
+
+ org.slf4j
+ slf4j-log4j12
+ test
+ =
+
+
+
+
+ src/main/java
+
+ **/*.xml
+ **/*.xsl
+ **/*.properties
+ **/*.ion
+ **/*.conf
+ **/*.config
+
+
+
+ src/main/resources
+
+ **/*.xml
+ **/*.xsl
+ **/*.properties
+ **/login.conf
+ **/*.ion
+ **/*.conf
+ **/*.config
+
+
+
+
+
+ src/test/java
+
+ **/*.properties
+ **/*.xml
+ **/*.txt
+ **/*.conf
+ **/*.config
+
+
+
+ src/test/resources
+
+ **/*.properties
+ **/*.xml
+ **/*.txt
+ **/*.conf
+ **/*.config
+
+
+
+
+
+ exo.jcr.component.core
+ exo.jcr.component.statistics
+ exo.jcr.component.ext
+ exo.jcr.component.ftp
+ exo.jcr.component.webdav
+ exo.jcr.connectors.localadapter
+ exo.jcr.framework.command
+ exo.jcr.framework.web
+ exo.jcr.framework.ftpclient
+ applications
+ exo.jcr.docs
+ packaging/module
+
+
--===============0108486488028965454==--
From do-not-reply at jboss.org Mon Oct 4 07:16:53 2010
Content-Type: multipart/mixed; boundary="===============7700525832356817790=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3235 - in jcr/branches/1.14-CNK:
applications and 24 other directories.
Date: Mon, 04 Oct 2010 07:16:53 -0400
Message-ID: <201010041116.o94BGrh6002054@svn01.web.mwc.hst.phx2.redhat.com>
--===============7700525832356817790==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: tolusha
Date: 2010-10-04 07:16:53 -0400 (Mon, 04 Oct 2010)
New Revision: 3235
Modified:
jcr/branches/1.14-CNK/applications/exo.jcr.applications.backupconsole/po=
m.xml
jcr/branches/1.14-CNK/applications/exo.jcr.applications.browser/pom.xml
jcr/branches/1.14-CNK/applications/exo.jcr.applications.config/pom.xml
jcr/branches/1.14-CNK/applications/exo.jcr.applications.fckeditor/pom.xml
jcr/branches/1.14-CNK/applications/exo.jcr.applications.jboss/pom.xml
jcr/branches/1.14-CNK/applications/exo.jcr.applications.jetty/pom.xml
jcr/branches/1.14-CNK/applications/exo.jcr.applications.jonas/pom.xml
jcr/branches/1.14-CNK/applications/exo.jcr.applications.rest/pom.xml
jcr/branches/1.14-CNK/applications/exo.jcr.applications.tomcat/pom.xml
jcr/branches/1.14-CNK/applications/exo.jcr.cluster.testclient/pom.xml
jcr/branches/1.14-CNK/applications/exo.jcr.ear/pom.xml
jcr/branches/1.14-CNK/applications/pom.xml
jcr/branches/1.14-CNK/exo.jcr.component.core/pom.xml
jcr/branches/1.14-CNK/exo.jcr.component.ext/pom.xml
jcr/branches/1.14-CNK/exo.jcr.component.ftp/pom.xml
jcr/branches/1.14-CNK/exo.jcr.component.statistics/pom.xml
jcr/branches/1.14-CNK/exo.jcr.component.webdav/pom.xml
jcr/branches/1.14-CNK/exo.jcr.connectors.localadapter/pom.xml
jcr/branches/1.14-CNK/exo.jcr.docs/exo.jcr.docs.developer/en/pom.xml
jcr/branches/1.14-CNK/exo.jcr.docs/exo.jcr.docs.developer/pom.xml
jcr/branches/1.14-CNK/exo.jcr.docs/pom.xml
jcr/branches/1.14-CNK/exo.jcr.framework.command/pom.xml
jcr/branches/1.14-CNK/exo.jcr.framework.ftpclient/pom.xml
jcr/branches/1.14-CNK/exo.jcr.framework.web/pom.xml
jcr/branches/1.14-CNK/packaging/module/pom.xml
jcr/branches/1.14-CNK/pom.xml
Log:
EXOJCR-987: prepare branch 1.14-CNK
Modified: jcr/branches/1.14-CNK/applications/exo.jcr.applications.backupcon=
sole/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/applications/exo.jcr.applications.backupconsole/p=
om.xml 2010-10-04 10:38:19 UTC (rev 3234)
+++ jcr/branches/1.14-CNK/applications/exo.jcr.applications.backupconsole/p=
om.xml 2010-10-04 11:16:53 UTC (rev 3235)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-applications-parent
- 1.14.0-Beta02
+ 1.14-CNK-SNAPSHOT
exo.jcr.applications.backupconsole
eXo JCR :: Applications :: Backup Console
Modified: jcr/branches/1.14-CNK/applications/exo.jcr.applications.browser/p=
om.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/applications/exo.jcr.applications.browser/pom.xml=
2010-10-04 10:38:19 UTC (rev 3234)
+++ jcr/branches/1.14-CNK/applications/exo.jcr.applications.browser/pom.xml=
2010-10-04 11:16:53 UTC (rev 3235)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-applications-parent
- 1.14.0-Beta02
+ 1.14-CNK-SNAPSHOT
exo.jcr.applications.browser
war
Modified: jcr/branches/1.14-CNK/applications/exo.jcr.applications.config/po=
m.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/applications/exo.jcr.applications.config/pom.xml =
2010-10-04 10:38:19 UTC (rev 3234)
+++ jcr/branches/1.14-CNK/applications/exo.jcr.applications.config/pom.xml =
2010-10-04 11:16:53 UTC (rev 3235)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-applications-parent
- 1.14.0-Beta02
+ 1.14-CNK-SNAPSHOT
exo.jcr.applications.config
pom
Modified: jcr/branches/1.14-CNK/applications/exo.jcr.applications.fckeditor=
/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/applications/exo.jcr.applications.fckeditor/pom.x=
ml 2010-10-04 10:38:19 UTC (rev 3234)
+++ jcr/branches/1.14-CNK/applications/exo.jcr.applications.fckeditor/pom.x=
ml 2010-10-04 11:16:53 UTC (rev 3235)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-applications-parent
- 1.14.0-Beta02
+ 1.14-CNK-SNAPSHOT
exo.jcr.applications.fckeditor
war
Modified: jcr/branches/1.14-CNK/applications/exo.jcr.applications.jboss/pom=
.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/applications/exo.jcr.applications.jboss/pom.xml 2=
010-10-04 10:38:19 UTC (rev 3234)
+++ jcr/branches/1.14-CNK/applications/exo.jcr.applications.jboss/pom.xml 2=
010-10-04 11:16:53 UTC (rev 3235)
@@ -22,7 +22,7 @@
org.exoplatform.jcr
exo.jcr.applications.config
- 1.14.0-Beta02
+ 1.14-CNK-SNAPSHOT
=
4.0.0
@@ -40,7 +40,7 @@
org.exoplatform.jcr
exo.jcr.ear
- 1.14.0-Beta02
+ 1.14-CNK-SNAPSHOT
ear
runtime
Modified: jcr/branches/1.14-CNK/applications/exo.jcr.applications.jetty/pom=
.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/applications/exo.jcr.applications.jetty/pom.xml 2=
010-10-04 10:38:19 UTC (rev 3234)
+++ jcr/branches/1.14-CNK/applications/exo.jcr.applications.jetty/pom.xml 2=
010-10-04 11:16:53 UTC (rev 3235)
@@ -22,7 +22,7 @@
org.exoplatform.jcr
exo.jcr.applications.config
- 1.14.0-Beta02
+ 1.14-CNK-SNAPSHOT
exo.jcr.applications.config
=
Modified: jcr/branches/1.14-CNK/applications/exo.jcr.applications.jonas/pom=
.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/applications/exo.jcr.applications.jonas/pom.xml 2=
010-10-04 10:38:19 UTC (rev 3234)
+++ jcr/branches/1.14-CNK/applications/exo.jcr.applications.jonas/pom.xml 2=
010-10-04 11:16:53 UTC (rev 3235)
@@ -22,7 +22,7 @@
org.exoplatform.jcr
exo.jcr.applications.config
- 1.14.0-Beta02
+ 1.14-CNK-SNAPSHOT
=
4.0.0
@@ -40,7 +40,7 @@
org.exoplatform.jcr
exo.jcr.ear
- 1.14.0-Beta02
+ 1.14-CNK-SNAPSHOT
ear
runtime
Modified: jcr/branches/1.14-CNK/applications/exo.jcr.applications.rest/pom.=
xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/applications/exo.jcr.applications.rest/pom.xml 20=
10-10-04 10:38:19 UTC (rev 3234)
+++ jcr/branches/1.14-CNK/applications/exo.jcr.applications.rest/pom.xml 20=
10-10-04 11:16:53 UTC (rev 3235)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-applications-parent
- 1.14.0-Beta02
+ 1.14-CNK-SNAPSHOT
exo.jcr.applications.rest
war
Modified: jcr/branches/1.14-CNK/applications/exo.jcr.applications.tomcat/po=
m.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/applications/exo.jcr.applications.tomcat/pom.xml =
2010-10-04 10:38:19 UTC (rev 3234)
+++ jcr/branches/1.14-CNK/applications/exo.jcr.applications.tomcat/pom.xml =
2010-10-04 11:16:53 UTC (rev 3235)
@@ -22,7 +22,7 @@
org.exoplatform.jcr
exo.jcr.applications.config
- 1.14.0-Beta02
+ 1.14-CNK-SNAPSHOT
exo.jcr.applications.config
=
Modified: jcr/branches/1.14-CNK/applications/exo.jcr.cluster.testclient/pom=
.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/applications/exo.jcr.cluster.testclient/pom.xml 2=
010-10-04 10:38:19 UTC (rev 3234)
+++ jcr/branches/1.14-CNK/applications/exo.jcr.cluster.testclient/pom.xml 2=
010-10-04 11:16:53 UTC (rev 3235)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-applications-parent
- 1.14.0-Beta02
+ 1.14-CNK-SNAPSHOT
exo.jcr.cluster.testclient
eXo JCR :: Cluster :: Test Client
Modified: jcr/branches/1.14-CNK/applications/exo.jcr.ear/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/applications/exo.jcr.ear/pom.xml 2010-10-04 10:38=
:19 UTC (rev 3234)
+++ jcr/branches/1.14-CNK/applications/exo.jcr.ear/pom.xml 2010-10-04 11:16=
:53 UTC (rev 3235)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-applications-parent
- 1.14.0-Beta02
+ 1.14-CNK-SNAPSHOT
exo.jcr.ear
ear
Modified: jcr/branches/1.14-CNK/applications/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/applications/pom.xml 2010-10-04 10:38:19 UTC (rev=
3234)
+++ jcr/branches/1.14-CNK/applications/pom.xml 2010-10-04 11:16:53 UTC (rev=
3235)
@@ -22,12 +22,12 @@
org.exoplatform.jcr
jcr-parent
- 1.14.0-Beta02
+ 1.14-CNK-SNAPSHOT
=
4.0.0
jcr-applications-parent
- 1.14.0-Beta02
+ 1.14-CNK-SNAPSHOT
=
eXo JCR :: Applications :: Reactor
pom
Modified: jcr/branches/1.14-CNK/exo.jcr.component.core/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/exo.jcr.component.core/pom.xml 2010-10-04 10:38:1=
9 UTC (rev 3234)
+++ jcr/branches/1.14-CNK/exo.jcr.component.core/pom.xml 2010-10-04 11:16:5=
3 UTC (rev 3235)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-parent
- 1.14.0-Beta02
+ 1.14-CNK-SNAPSHOT
exo.jcr.component.core
eXo JCR :: Component :: Core Service
Modified: jcr/branches/1.14-CNK/exo.jcr.component.ext/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/exo.jcr.component.ext/pom.xml 2010-10-04 10:38:19=
UTC (rev 3234)
+++ jcr/branches/1.14-CNK/exo.jcr.component.ext/pom.xml 2010-10-04 11:16:53=
UTC (rev 3235)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-parent
- 1.14.0-Beta02
+ 1.14-CNK-SNAPSHOT
exo.jcr.component.ext
eXo JCR :: Component :: Extension Service
Modified: jcr/branches/1.14-CNK/exo.jcr.component.ftp/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/exo.jcr.component.ftp/pom.xml 2010-10-04 10:38:19=
UTC (rev 3234)
+++ jcr/branches/1.14-CNK/exo.jcr.component.ftp/pom.xml 2010-10-04 11:16:53=
UTC (rev 3235)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-parent
- 1.14.0-Beta02
+ 1.14-CNK-SNAPSHOT
exo.jcr.component.ftp
eXo JCR :: Component :: FTP Service
Modified: jcr/branches/1.14-CNK/exo.jcr.component.statistics/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/exo.jcr.component.statistics/pom.xml 2010-10-04 1=
0:38:19 UTC (rev 3234)
+++ jcr/branches/1.14-CNK/exo.jcr.component.statistics/pom.xml 2010-10-04 1=
1:16:53 UTC (rev 3235)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-parent
- 1.14.0-Beta02
+ 1.14-CNK-SNAPSHOT
exo.jcr.component.statistics
eXo JCR :: Component :: Statistics Provider
Modified: jcr/branches/1.14-CNK/exo.jcr.component.webdav/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/exo.jcr.component.webdav/pom.xml 2010-10-04 10:38=
:19 UTC (rev 3234)
+++ jcr/branches/1.14-CNK/exo.jcr.component.webdav/pom.xml 2010-10-04 11:16=
:53 UTC (rev 3235)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-parent
- 1.14.0-Beta02
+ 1.14-CNK-SNAPSHOT
exo.jcr.component.webdav
eXo JCR :: Component :: Webdav Service
Modified: jcr/branches/1.14-CNK/exo.jcr.connectors.localadapter/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/exo.jcr.connectors.localadapter/pom.xml 2010-10-0=
4 10:38:19 UTC (rev 3234)
+++ jcr/branches/1.14-CNK/exo.jcr.connectors.localadapter/pom.xml 2010-10-0=
4 11:16:53 UTC (rev 3235)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-parent
- 1.14.0-Beta02
+ 1.14-CNK-SNAPSHOT
exo.jcr.connectors.localadapter
rar
Modified: jcr/branches/1.14-CNK/exo.jcr.docs/exo.jcr.docs.developer/en/pom.=
xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/exo.jcr.docs/exo.jcr.docs.developer/en/pom.xml 20=
10-10-04 10:38:19 UTC (rev 3234)
+++ jcr/branches/1.14-CNK/exo.jcr.docs/exo.jcr.docs.developer/en/pom.xml 20=
10-10-04 11:16:53 UTC (rev 3235)
@@ -22,7 +22,7 @@
org.exoplatform.jcr
exo.jcr.docs.developer
- 1.14.0-Beta02
+ 1.14-CNK-SNAPSHOT
=
4.0.0
Modified: jcr/branches/1.14-CNK/exo.jcr.docs/exo.jcr.docs.developer/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/exo.jcr.docs/exo.jcr.docs.developer/pom.xml 2010-=
10-04 10:38:19 UTC (rev 3234)
+++ jcr/branches/1.14-CNK/exo.jcr.docs/exo.jcr.docs.developer/pom.xml 2010-=
10-04 11:16:53 UTC (rev 3235)
@@ -22,7 +22,7 @@
org.exoplatform.jcr
exo.jcr.docs
- 1.14.0-Beta02
+ 1.14-CNK-SNAPSHOT
=
4.0.0
Modified: jcr/branches/1.14-CNK/exo.jcr.docs/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/exo.jcr.docs/pom.xml 2010-10-04 10:38:19 UTC (rev=
3234)
+++ jcr/branches/1.14-CNK/exo.jcr.docs/pom.xml 2010-10-04 11:16:53 UTC (rev=
3235)
@@ -22,7 +22,7 @@
org.exoplatform.jcr
jcr-parent
- 1.14.0-Beta02
+ 1.14-CNK-SNAPSHOT
=
4.0.0
Modified: jcr/branches/1.14-CNK/exo.jcr.framework.command/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/exo.jcr.framework.command/pom.xml 2010-10-04 10:3=
8:19 UTC (rev 3234)
+++ jcr/branches/1.14-CNK/exo.jcr.framework.command/pom.xml 2010-10-04 11:1=
6:53 UTC (rev 3235)
@@ -12,7 +12,7 @@
org.exoplatform.jcr
jcr-parent
- 1.14.0-Beta02
+ 1.14-CNK-SNAPSHOT
exo.jcr.framework.command
eXo JCR :: Framework :: Command
Modified: jcr/branches/1.14-CNK/exo.jcr.framework.ftpclient/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/exo.jcr.framework.ftpclient/pom.xml 2010-10-04 10=
:38:19 UTC (rev 3234)
+++ jcr/branches/1.14-CNK/exo.jcr.framework.ftpclient/pom.xml 2010-10-04 11=
:16:53 UTC (rev 3235)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-parent
- 1.14.0-Beta02
+ 1.14-CNK-SNAPSHOT
exo.jcr.framework.ftpclient
eXo JCR :: Framework :: FTP Client
Modified: jcr/branches/1.14-CNK/exo.jcr.framework.web/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/exo.jcr.framework.web/pom.xml 2010-10-04 10:38:19=
UTC (rev 3234)
+++ jcr/branches/1.14-CNK/exo.jcr.framework.web/pom.xml 2010-10-04 11:16:53=
UTC (rev 3235)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-parent
- 1.14.0-Beta02
+ 1.14-CNK-SNAPSHOT
exo.jcr.framework.web
eXo JCR :: Framework :: Web
Modified: jcr/branches/1.14-CNK/packaging/module/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/packaging/module/pom.xml 2010-10-04 10:38:19 UTC =
(rev 3234)
+++ jcr/branches/1.14-CNK/packaging/module/pom.xml 2010-10-04 11:16:53 UTC =
(rev 3235)
@@ -4,7 +4,7 @@
org.exoplatform.jcr
jcr-parent
- 1.14.0-Beta02
+ 1.14-CNK-SNAPSHOT
jcr.packaging.module
pom
Modified: jcr/branches/1.14-CNK/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/pom.xml 2010-10-04 10:38:19 UTC (rev 3234)
+++ jcr/branches/1.14-CNK/pom.xml 2010-10-04 11:16:53 UTC (rev 3235)
@@ -29,7 +29,7 @@
=
org.exoplatform.jcr
jcr-parent
- 1.14.0-Beta02
+ 1.14-CNK-SNAPSHOT
pom
eXo JCR
=
--===============7700525832356817790==--
From do-not-reply at jboss.org Mon Oct 4 10:01:56 2010
Content-Type: multipart/mixed; boundary="===============4838382243798862802=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3236 -
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl.
Date: Mon, 04 Oct 2010 10:01:55 -0400
Message-ID: <201010041401.o94E1tJX021384@svn01.web.mwc.hst.phx2.redhat.com>
--===============4838382243798862802==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: tolusha
Date: 2010-10-04 10:01:54 -0400 (Mon, 04 Oct 2010)
New Revision: 3236
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/=
jcr/impl/RepositoryServiceImpl.java
Log:
EXOJCR-971: prevent unauthorized access to the methods of RepositoryService=
Impl
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/se=
rvices/jcr/impl/RepositoryServiceImpl.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services=
/jcr/impl/RepositoryServiceImpl.java 2010-10-04 11:16:53 UTC (rev 3235)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services=
/jcr/impl/RepositoryServiceImpl.java 2010-10-04 14:01:54 UTC (rev 3236)
@@ -30,6 +30,7 @@
import org.exoplatform.services.jcr.config.WorkspaceEntry;
import org.exoplatform.services.jcr.core.ManageableRepository;
import org.exoplatform.services.jcr.core.nodetype.ExtendedNodeTypeManager;
+import org.exoplatform.services.jcr.core.security.JCRRuntimePermissions;
import org.exoplatform.services.jcr.dataflow.persistent.ItemsPersistenceLi=
stener;
import org.exoplatform.services.jcr.impl.core.RepositoryImpl;
import org.exoplatform.services.jcr.impl.core.SessionRegistry;
@@ -43,8 +44,8 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.StringTokenizer;
-import java.util.Map.Entry;
=
import javax.jcr.RepositoryException;
=
@@ -120,6 +121,13 @@
public synchronized void createRepository(RepositoryEntry rEntry) throw=
s RepositoryConfigurationException,
RepositoryException
{
+ // Need privileges to manage repository.
+ SecurityManager security =3D System.getSecurityManager();
+ if (security !=3D null)
+ {
+ security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_=
PERMISSION);
+ }
+
if (repositoryContainers.containsKey(rEntry.getName()))
{
throw new RepositoryConfigurationException("Repository container =
" + rEntry.getName() + " already started");
@@ -161,6 +169,13 @@
=
public RepositoryServiceConfiguration getConfig()
{
+ // Need privileges to manage repository.
+ SecurityManager security =3D System.getSecurityManager();
+ if (security !=3D null)
+ {
+ security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_=
PERMISSION);
+ }
+
return config;
}
=
@@ -207,6 +222,13 @@
=
public void setCurrentRepositoryName(String repositoryName) throws Repo=
sitoryConfigurationException
{
+ // Need privileges to manage repository.
+ SecurityManager security =3D System.getSecurityManager();
+ if (security !=3D null)
+ {
+ security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_=
PERMISSION);
+ }
+
if (!repositoryContainers.containsKey(repositoryName))
throw new RepositoryConfigurationException("Repository is not con=
figured. Name " + repositoryName);
currentRepositoryName.set(repositoryName);
@@ -214,6 +236,13 @@
=
public void start()
{
+ // Need privileges to manage repository.
+ SecurityManager security =3D System.getSecurityManager();
+ if (security !=3D null)
+ {
+ security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_=
PERMISSION);
+ }
+
try
{
ExoContainer container =3D null;
@@ -246,6 +275,13 @@
=
public void stop()
{
+ // Need privileges to manage repository.
+ SecurityManager security =3D System.getSecurityManager();
+ if (security !=3D null)
+ {
+ security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_=
PERMISSION);
+ }
+
for (Entry entry : repositoryContainers=
.entrySet())
{
entry.getValue().stop();
@@ -351,6 +387,13 @@
*/
private void removeRepository(String name, boolean allowRemoveDefaultRe=
pository) throws RepositoryException
{
+ // Need privileges to manage repository.
+ SecurityManager security =3D System.getSecurityManager();
+ if (security !=3D null)
+ {
+ security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_=
PERMISSION);
+ }
+
if (!canRemoveRepository(name, allowRemoveDefaultRepository))
throw new RepositoryException("Repository " + name + " in use. If=
you want to "
+ " remove repository close all open sessions");
--===============4838382243798862802==--
From do-not-reply at jboss.org Mon Oct 4 10:39:54 2010
Content-Type: multipart/mixed; boundary="===============5372149679607007177=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3237 - in
kernel/branches/2.2.x/exo.kernel.container/src:
test/java/org/exoplatform/container/configuration and 1 other directory.
Date: Mon, 04 Oct 2010 10:39:54 -0400
Message-ID: <201010041439.o94EdsVm028761@svn01.web.mwc.hst.phx2.redhat.com>
--===============5372149679607007177==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: sergiykarpenko
Date: 2010-10-04 10:39:54 -0400 (Mon, 04 Oct 2010)
New Revision: 3237
Modified:
kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform=
/container/StandaloneContainer.java
kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatform=
/container/configuration/TestConfigurationManagerImpl.java
Log:
JCR-1466: StandaloneContainer.initConfigurationURL fixed
Modified: kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exop=
latform/container/StandaloneContainer.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatfor=
m/container/StandaloneContainer.java 2010-10-04 14:01:54 UTC (rev 3236)
+++ kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatfor=
m/container/StandaloneContainer.java 2010-10-04 14:39:54 UTC (rev 3237)
@@ -332,12 +332,13 @@
J2EEServerInfo env =3D new J2EEServerInfo();
=
// (2) exo-configuration.xml in AS (standalone) home directory
- configurationURL =3D new URL("file:" + env.getServerHome() + "/ex=
o-configuration.xml");
+ configurationURL =3D (new File(env.getServerHome() + "/exo-config=
uration.xml")).toURI().toURL();
=
// (3) AS_HOME/conf/exo-conf (JBossAS usecase)
if (!fileExists(configurationURL))
{
- configurationURL =3D new URL("file:" + env.getExoConfiguration=
Directory() + "/exo-configuration.xml");
+ configurationURL =3D
+ (new File(env.getExoConfigurationDirectory() + "/exo-config=
uration.xml")).toURI().toURL();
}
=
// (4) conf/exo-configuration.xml in war/ear(?)
Modified: kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exop=
latform/container/configuration/TestConfigurationManagerImpl.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatfor=
m/container/configuration/TestConfigurationManagerImpl.java 2010-10-04 14:0=
1:54 UTC (rev 3236)
+++ kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatfor=
m/container/configuration/TestConfigurationManagerImpl.java 2010-10-04 14:3=
9:54 UTC (rev 3237)
@@ -198,7 +198,33 @@
url =3D cm3.getURL("configuration\\empty-config-fake.xml");
checkURL(url, true); =
}
+ =
+ public void testGetFileURL() throws Exception
+ {
+ // Empty CM
+ ConfigurationManager cm =3D new ConfigurationManagerImpl();
+ URL url =3D cm.getURL(null);
+ assertNull(url);
+ url =3D cm.getURL("file:F:\\somepath\\path\\configuration.xml");
+ assertEquals("file:/F:/somepath/path/configuration.xml", url.toStrin=
g());
=
+ //make context configuration starting fith "file:D:..."
+ try
+ {
+ cm.addConfiguration("file:D:\\somepath\\config.xml");
+ }
+ catch (Exception e)
+ {
+ // thats is ok, because such config does not exists, =
+ // but ConfigurationManagerInmp.contextPath going to be initializ=
ed
+ // thats all we need to reproduce bug.
+ }
+
+ // now lets check relative url
+ url =3D cm.getURL("configuration.xml");
+ assertEquals("file:/D:/somepath/configuration.xml", url.toString());
+ }
+
private void checkURL(URL url) throws Exception
{
checkURL(url, false);
--===============5372149679607007177==--
From do-not-reply at jboss.org Mon Oct 4 10:48:43 2010
Content-Type: multipart/mixed; boundary="===============1380720962590770355=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3238 - in
kernel/trunk/exo.kernel.container/src:
test/java/org/exoplatform/container/configuration and 1 other directory.
Date: Mon, 04 Oct 2010 10:48:43 -0400
Message-ID: <201010041448.o94Emh4L029077@svn01.web.mwc.hst.phx2.redhat.com>
--===============1380720962590770355==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: sergiykarpenko
Date: 2010-10-04 10:48:42 -0400 (Mon, 04 Oct 2010)
New Revision: 3238
Modified:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/containe=
r/StandaloneContainer.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/containe=
r/configuration/TestConfigurationManagerImpl.java
Log:
EXOJCR-988: StandaloneContainer.initConfigurationURL fixed
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/c=
ontainer/StandaloneContainer.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/contain=
er/StandaloneContainer.java 2010-10-04 14:39:54 UTC (rev 3237)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/contain=
er/StandaloneContainer.java 2010-10-04 14:48:42 UTC (rev 3238)
@@ -332,12 +332,13 @@
J2EEServerInfo env =3D new J2EEServerInfo();
=
// (2) exo-configuration.xml in AS (standalone) home directory
- configurationURL =3D new URL("file:" + env.getServerHome() + "/ex=
o-configuration.xml");
+ configurationURL =3D (new File(env.getServerHome() + "/exo-config=
uration.xml")).toURI().toURL();
=
// (3) AS_HOME/conf/exo-conf (JBossAS usecase)
if (!fileExists(configurationURL))
{
- configurationURL =3D new URL("file:" + env.getExoConfiguration=
Directory() + "/exo-configuration.xml");
+ configurationURL =3D
+ (new File(env.getExoConfigurationDirectory() + "/exo-config=
uration.xml")).toURI().toURL();
}
=
// (4) conf/exo-configuration.xml in war/ear(?)
Modified: kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/c=
ontainer/configuration/TestConfigurationManagerImpl.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/contain=
er/configuration/TestConfigurationManagerImpl.java 2010-10-04 14:39:54 UTC =
(rev 3237)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/contain=
er/configuration/TestConfigurationManagerImpl.java 2010-10-04 14:48:42 UTC =
(rev 3238)
@@ -1,441 +1,467 @@
-/*
- * 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.container.configuration;
-
-import junit.framework.TestCase;
-
-import org.exoplatform.container.xml.Configuration;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.Set;
-
-import javax.servlet.RequestDispatcher;
-import javax.servlet.Servlet;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-
-/**
- * Created by The eXo Platform SAS
- * Author : Nicolas Filotto =
- * nicolas.filotto(a)exoplatform.com
- * 22 f=EF=BF=BDvr. 2010 =
- */
-public class TestConfigurationManagerImpl extends TestCase
-{
- public void testGetURL() throws Exception
- {
- // Empty CM
- ConfigurationManager cm =3D new ConfigurationManagerImpl();
- URL url =3D cm.getURL(null);
- assertNull(url);
- url =3D cm.getURL("jar:/org/exoplatform/container/configuration/empt=
y-config.xml");
- checkURL(url);
- url =3D cm.getURL("jar:/org/exoplatform/container/configuration/empt=
y-config-fake.xml");
- assertNull(url);
- url =3D cm.getURL("classpath:/org/exoplatform/container/configuratio=
n/empty-config.xml");
- checkURL(url);
- url =3D cm.getURL("classpath:/org/exoplatform/container/configuratio=
n/empty-config-fake.xml");
- assertNull(url);
- try
- {
- url =3D cm.getURL("war:/org/exoplatform/container/configuration/e=
mpty-config.xml");
- fail("An error should be thrown");
- }
- catch (Exception e)
- {
- // ok;
- }
- try
- {
- url =3D cm.getURL("war:/org/exoplatform/container/configuration/e=
mpty-config-fake.xml");
- fail("An error should be thrown");
- }
- catch (Exception e)
- {
- // ok;
- }
- String sURL =3D getClass().getResource("empty-config.xml").toString(=
);
- assertNotNull(sURL);
- assertTrue("the expected path should starts with file:", sURL.starts=
With("file:"));
- sURL =3D sURL.substring(0, sURL.lastIndexOf('/'));
- sURL =3D sURL.substring(0, sURL.lastIndexOf('/'));
- url =3D cm.getURL(sURL + "/configuration/empty-config.xml");
- checkURL(url);
- url =3D cm.getURL(sURL + "/configuration/empty-config-fake.xml");
- checkURL(url, true);
- url =3D cm.getURL(sURL + "\\configuration\\empty-config.xml");
- checkURL(url);
- url =3D cm.getURL(sURL + "\\configuration\\empty-config-fake.xml");
- checkURL(url, true);
- String incompleteURL =3D "file:/" + getClass().getResource("empty-co=
nfig.xml").getPath();
- incompleteURL =3D incompleteURL.substring(0, incompleteURL.lastIndex=
Of('/'));
- url =3D cm.getURL(incompleteURL + "/empty-config.xml");
- checkURL(url);
- url =3D cm.getURL(incompleteURL + "/empty-config-fake.xml");
- checkURL(url, true);
- incompleteURL =3D "file:" + getClass().getResource("empty-config.xml=
").getPath();
- incompleteURL =3D incompleteURL.substring(0, incompleteURL.lastIndex=
Of('/'));
- url =3D cm.getURL(incompleteURL + "/empty-config.xml");
- checkURL(url);
- url =3D cm.getURL(incompleteURL + "/empty-config-fake.xml");
- checkURL(url, true); =
- url =3D cm.getURL("org/exoplatform/container/configuration/empty-con=
fig.xml");
- assertNull(url);
- url =3D cm.getURL("org/exoplatform/container/configuration/empty-con=
fig-fake.xml");
- assertNull(url);
- =
- // CM with ClassLoader
- ConfigurationManager cm1 =3D new ConfigurationManagerImpl(Thread.cur=
rentThread().getContextClassLoader(), null);
- url =3D cm1.getURL(null);
- assertNull(url); =
- url =3D cm1.getURL("jar:/org/exoplatform/container/configuration/emp=
ty-config.xml");
- checkURL(url);
- url =3D cm1.getURL("jar:/org/exoplatform/container/configuration/emp=
ty-config-fake.xml");
- assertNull(url);
- url =3D cm1.getURL("classpath:/org/exoplatform/container/configurati=
on/empty-config.xml");
- checkURL(url);
- url =3D cm1.getURL("classpath:/org/exoplatform/container/configurati=
on/empty-config-fake.xml");
- assertNull(url);
- url =3D cm1.getURL("war:/org/exoplatform/container/configuration/emp=
ty-config.xml");
- checkURL(url);
- url =3D cm1.getURL("war:/org/exoplatform/container/configuration/emp=
ty-config-fake.xml");
- assertNull(url);
- url =3D cm1.getURL(sURL + "/configuration/empty-config.xml");
- checkURL(url);
- url =3D cm1.getURL(sURL + "/configuration/empty-config-fake.xml");
- checkURL(url, true);
- url =3D cm1.getURL("org/exoplatform/container/configuration/empty-co=
nfig.xml");
- assertNull(url);
- url =3D cm1.getURL("org/exoplatform/container/configuration/empty-co=
nfig-fake.xml");
- assertNull(url);
- =
- // CM with ServletContext
- ConfigurationManager cm2 =3D new ConfigurationManagerImpl(new MockSe=
rvletContext(), null);
- url =3D cm2.getURL(null);
- assertNull(url); =
- url =3D cm2.getURL("jar:/org/exoplatform/container/configuration/emp=
ty-config.xml");
- checkURL(url);
- url =3D cm2.getURL("jar:/org/exoplatform/container/configuration/emp=
ty-config-fake.xml");
- assertNull(url);
- url =3D cm2.getURL("classpath:/org/exoplatform/container/configurati=
on/empty-config.xml");
- checkURL(url);
- url =3D cm2.getURL("classpath:/org/exoplatform/container/configurati=
on/empty-config-fake.xml");
- assertNull(url);
- url =3D cm2.getURL("war:/org/exoplatform/container/configuration/emp=
ty-config.xml");
- checkURL(url);
- url =3D cm2.getURL("war:/org/exoplatform/container/configuration/emp=
ty-config-fake.xml");
- assertNull(url);
- url =3D cm2.getURL(sURL + "/configuration/empty-config.xml");
- checkURL(url);
- url =3D cm2.getURL(sURL + "/configuration/empty-config-fake.xml");
- checkURL(url, true);
- url =3D cm2.getURL("org/exoplatform/container/configuration/empty-co=
nfig.xml");
- assertNull(url);
- url =3D cm2.getURL("org/exoplatform/container/configuration/empty-co=
nfig-fake.xml");
- assertNull(url); =
- =
- // CM with Context path
- ConfigurationManager cm3 =3D new ConfigurationManagerImpl();
- String path =3D getClass().getResource("empty-config.xml").getPath();
- assertNotNull(path);
- path =3D path.substring(0, path.lastIndexOf('/')); =
- cm3.addConfiguration((new File(path)).toURI().toURL());
- url =3D cm3.getURL(null);
- assertNull(url); =
- url =3D cm3.getURL("jar:/org/exoplatform/container/configuration/emp=
ty-config.xml");
- checkURL(url);
- url =3D cm3.getURL("jar:/org/exoplatform/container/configuration/emp=
ty-config-fake.xml");
- assertNull(url);
- url =3D cm3.getURL("classpath:/org/exoplatform/container/configurati=
on/empty-config.xml");
- checkURL(url);
- url =3D cm3.getURL("classpath:/org/exoplatform/container/configurati=
on/empty-config-fake.xml");
- assertNull(url);
- try
- {
- url =3D cm3.getURL("war:/org/exoplatform/container/configuration/=
empty-config.xml");
- fail("An error should be thrown");
- }
- catch (Exception e)
- {
- // ok;
- }
- try
- {
- url =3D cm3.getURL("war:/org/exoplatform/container/configuration/=
empty-config-fake.xml");
- fail("An error should be thrown");
- }
- catch (Exception e)
- {
- // ok;
- }
- url =3D cm3.getURL(sURL + "/configuration/empty-config.xml");
- checkURL(url);
- url =3D cm3.getURL(sURL + "/configuration/empty-config-fake.xml");
- checkURL(url, true);
- url =3D cm3.getURL("configuration/empty-config.xml");
- checkURL(url);
- url =3D cm3.getURL("configuration/empty-config-fake.xml");
- checkURL(url, true); =
- url =3D cm3.getURL("configuration\\empty-config.xml");
- checkURL(url);
- url =3D cm3.getURL("configuration\\empty-config-fake.xml");
- checkURL(url, true); =
- }
-
- public void testImport() throws Exception
- {
- // no import
- ConfigurationManager cm =3D new ConfigurationManagerImpl();
- cm.addConfiguration("classpath:/org/exoplatform/container/configurat=
ion/config-manager-configuration-a.xml");
- Configuration conf =3D cm.getConfiguration();
- assertNotNull(conf.getComponent("A"));
- assertTrue(conf.getComponent("A").getDocumentURL().getFile().endsWit=
h("config-manager-configuration-a.xml"));
- assertNull(conf.getComponent("B"));
- assertNull(conf.getComponent("C"));
- =
- // b import a
- cm =3D new ConfigurationManagerImpl();
- cm.addConfiguration("classpath:/org/exoplatform/container/configurat=
ion/config-manager-configuration-b.xml");
- conf =3D cm.getConfiguration();
- assertNotNull(conf.getComponent("A"));
- assertTrue(conf.getComponent("A").getDocumentURL().getFile().endsWit=
h("config-manager-configuration-a.xml"));
- assertNotNull(conf.getComponent("B"));
- assertTrue(conf.getComponent("B").getDocumentURL().getFile().endsWit=
h("config-manager-configuration-b.xml"));
- assertNull(conf.getComponent("C"));
- =
- // c import b and b import a
- cm =3D new ConfigurationManagerImpl();
- cm.addConfiguration("classpath:/org/exoplatform/container/configurat=
ion/config-manager-configuration-c.xml");
- conf =3D cm.getConfiguration();
- assertNotNull(conf.getComponent("A"));
- assertTrue(conf.getComponent("A").getDocumentURL().getFile().endsWit=
h("config-manager-configuration-a.xml"));
- assertNotNull(conf.getComponent("B"));
- assertTrue(conf.getComponent("B").getDocumentURL().getFile().endsWit=
h("config-manager-configuration-b.xml"));
- assertNotNull(conf.getComponent("C"));
- assertTrue(conf.getComponent("C").getDocumentURL().getFile().endsWit=
h("config-manager-configuration-c.xml"));
- }
- =
- private void checkURL(URL url) throws Exception
- {
- checkURL(url, false);
- }
- =
- private void checkURL(URL url, boolean empty) throws Exception
- {
- assertNotNull(url);
- InputStream is =3D null;
- try
- {
- is =3D url.openStream();
- if (empty)
- {
- assertNull(is);
- }
- else
- {
- assertNotNull(is);
- assertTrue(is.available() > 0); =
- }
- }
- catch (IOException e)
- {
- if (empty)
- {
- // OK
- } =
- else
- {
- throw e;
- }
- }
- finally
- {
- if (is !=3D null)
- {
- try
- {
- is.close();
- }
- catch (Exception e)
- {
- // ignore me
- }
- }
- }
- }
- =
- private static class MockServletContext implements ServletContext
- {
-
- public Object getAttribute(String arg0)
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Enumeration getAttributeNames()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public ServletContext getContext(String arg0)
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getContextPath()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getInitParameter(String arg0)
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Enumeration getInitParameterNames()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public int getMajorVersion()
- {
- // TODO Auto-generated method stub
- return 0;
- }
-
- public String getMimeType(String arg0)
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public int getMinorVersion()
- {
- // TODO Auto-generated method stub
- return 0;
- }
-
- public RequestDispatcher getNamedDispatcher(String arg0)
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getRealPath(String arg0)
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public RequestDispatcher getRequestDispatcher(String arg0)
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public URL getResource(String arg0) throws MalformedURLException
- {
- // We remove "/WEB-INF/
- String path =3D arg0.substring(ConfigurationManagerImpl.WAR_CONF_=
LOCATION.length() + 1);
- return Thread.currentThread().getContextClassLoader().getResource=
(path);
- }
-
- public InputStream getResourceAsStream(String arg0)
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Set getResourcePaths(String arg0)
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getServerInfo()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Servlet getServlet(String arg0) throws ServletException
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getServletContextName()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Enumeration getServletNames()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Enumeration getServlets()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void log(String arg0)
- {
- // TODO Auto-generated method stub
- =
- }
-
- public void log(Exception arg0, String arg1)
- {
- // TODO Auto-generated method stub
- =
- }
-
- public void log(String arg0, Throwable arg1)
- {
- // TODO Auto-generated method stub
- =
- }
-
- public void removeAttribute(String arg0)
- {
- // TODO Auto-generated method stub
- =
- }
-
- public void setAttribute(String arg0, Object arg1)
- {
- // TODO Auto-generated method stub
- =
- }
- =
- }
-}
+/*
+ * 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.container.configuration;
+
+import junit.framework.TestCase;
+
+import org.exoplatform.container.xml.Configuration;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Set;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+/**
+ * Created by The eXo Platform SAS
+ * Author : Nicolas Filotto =
+ * nicolas.filotto(a)exoplatform.com
+ * 22 f=EF=BF=BDvr. 2010 =
+ */
+public class TestConfigurationManagerImpl extends TestCase
+{
+ public void testGetURL() throws Exception
+ {
+ // Empty CM
+ ConfigurationManager cm =3D new ConfigurationManagerImpl();
+ URL url =3D cm.getURL(null);
+ assertNull(url);
+ url =3D cm.getURL("jar:/org/exoplatform/container/configuration/empt=
y-config.xml");
+ checkURL(url);
+ url =3D cm.getURL("jar:/org/exoplatform/container/configuration/empt=
y-config-fake.xml");
+ assertNull(url);
+ url =3D cm.getURL("classpath:/org/exoplatform/container/configuratio=
n/empty-config.xml");
+ checkURL(url);
+ url =3D cm.getURL("classpath:/org/exoplatform/container/configuratio=
n/empty-config-fake.xml");
+ assertNull(url);
+ try
+ {
+ url =3D cm.getURL("war:/org/exoplatform/container/configuration/e=
mpty-config.xml");
+ fail("An error should be thrown");
+ }
+ catch (Exception e)
+ {
+ // ok;
+ }
+ try
+ {
+ url =3D cm.getURL("war:/org/exoplatform/container/configuration/e=
mpty-config-fake.xml");
+ fail("An error should be thrown");
+ }
+ catch (Exception e)
+ {
+ // ok;
+ }
+ String sURL =3D getClass().getResource("empty-config.xml").toString(=
);
+ assertNotNull(sURL);
+ assertTrue("the expected path should starts with file:", sURL.starts=
With("file:"));
+ sURL =3D sURL.substring(0, sURL.lastIndexOf('/'));
+ sURL =3D sURL.substring(0, sURL.lastIndexOf('/'));
+ url =3D cm.getURL(sURL + "/configuration/empty-config.xml");
+ checkURL(url);
+ url =3D cm.getURL(sURL + "/configuration/empty-config-fake.xml");
+ checkURL(url, true);
+ url =3D cm.getURL(sURL + "\\configuration\\empty-config.xml");
+ checkURL(url);
+ url =3D cm.getURL(sURL + "\\configuration\\empty-config-fake.xml");
+ checkURL(url, true);
+ String incompleteURL =3D "file:/" + getClass().getResource("empty-co=
nfig.xml").getPath();
+ incompleteURL =3D incompleteURL.substring(0, incompleteURL.lastIndex=
Of('/'));
+ url =3D cm.getURL(incompleteURL + "/empty-config.xml");
+ checkURL(url);
+ url =3D cm.getURL(incompleteURL + "/empty-config-fake.xml");
+ checkURL(url, true);
+ incompleteURL =3D "file:" + getClass().getResource("empty-config.xml=
").getPath();
+ incompleteURL =3D incompleteURL.substring(0, incompleteURL.lastIndex=
Of('/'));
+ url =3D cm.getURL(incompleteURL + "/empty-config.xml");
+ checkURL(url);
+ url =3D cm.getURL(incompleteURL + "/empty-config-fake.xml");
+ checkURL(url, true); =
+ url =3D cm.getURL("org/exoplatform/container/configuration/empty-con=
fig.xml");
+ assertNull(url);
+ url =3D cm.getURL("org/exoplatform/container/configuration/empty-con=
fig-fake.xml");
+ assertNull(url);
+ =
+ // CM with ClassLoader
+ ConfigurationManager cm1 =3D new ConfigurationManagerImpl(Thread.cur=
rentThread().getContextClassLoader(), null);
+ url =3D cm1.getURL(null);
+ assertNull(url); =
+ url =3D cm1.getURL("jar:/org/exoplatform/container/configuration/emp=
ty-config.xml");
+ checkURL(url);
+ url =3D cm1.getURL("jar:/org/exoplatform/container/configuration/emp=
ty-config-fake.xml");
+ assertNull(url);
+ url =3D cm1.getURL("classpath:/org/exoplatform/container/configurati=
on/empty-config.xml");
+ checkURL(url);
+ url =3D cm1.getURL("classpath:/org/exoplatform/container/configurati=
on/empty-config-fake.xml");
+ assertNull(url);
+ url =3D cm1.getURL("war:/org/exoplatform/container/configuration/emp=
ty-config.xml");
+ checkURL(url);
+ url =3D cm1.getURL("war:/org/exoplatform/container/configuration/emp=
ty-config-fake.xml");
+ assertNull(url);
+ url =3D cm1.getURL(sURL + "/configuration/empty-config.xml");
+ checkURL(url);
+ url =3D cm1.getURL(sURL + "/configuration/empty-config-fake.xml");
+ checkURL(url, true);
+ url =3D cm1.getURL("org/exoplatform/container/configuration/empty-co=
nfig.xml");
+ assertNull(url);
+ url =3D cm1.getURL("org/exoplatform/container/configuration/empty-co=
nfig-fake.xml");
+ assertNull(url);
+ =
+ // CM with ServletContext
+ ConfigurationManager cm2 =3D new ConfigurationManagerImpl(new MockSe=
rvletContext(), null);
+ url =3D cm2.getURL(null);
+ assertNull(url); =
+ url =3D cm2.getURL("jar:/org/exoplatform/container/configuration/emp=
ty-config.xml");
+ checkURL(url);
+ url =3D cm2.getURL("jar:/org/exoplatform/container/configuration/emp=
ty-config-fake.xml");
+ assertNull(url);
+ url =3D cm2.getURL("classpath:/org/exoplatform/container/configurati=
on/empty-config.xml");
+ checkURL(url);
+ url =3D cm2.getURL("classpath:/org/exoplatform/container/configurati=
on/empty-config-fake.xml");
+ assertNull(url);
+ url =3D cm2.getURL("war:/org/exoplatform/container/configuration/emp=
ty-config.xml");
+ checkURL(url);
+ url =3D cm2.getURL("war:/org/exoplatform/container/configuration/emp=
ty-config-fake.xml");
+ assertNull(url);
+ url =3D cm2.getURL(sURL + "/configuration/empty-config.xml");
+ checkURL(url);
+ url =3D cm2.getURL(sURL + "/configuration/empty-config-fake.xml");
+ checkURL(url, true);
+ url =3D cm2.getURL("org/exoplatform/container/configuration/empty-co=
nfig.xml");
+ assertNull(url);
+ url =3D cm2.getURL("org/exoplatform/container/configuration/empty-co=
nfig-fake.xml");
+ assertNull(url); =
+ =
+ // CM with Context path
+ ConfigurationManager cm3 =3D new ConfigurationManagerImpl();
+ String path =3D getClass().getResource("empty-config.xml").getPath();
+ assertNotNull(path);
+ path =3D path.substring(0, path.lastIndexOf('/')); =
+ cm3.addConfiguration((new File(path)).toURI().toURL());
+ url =3D cm3.getURL(null);
+ assertNull(url); =
+ url =3D cm3.getURL("jar:/org/exoplatform/container/configuration/emp=
ty-config.xml");
+ checkURL(url);
+ url =3D cm3.getURL("jar:/org/exoplatform/container/configuration/emp=
ty-config-fake.xml");
+ assertNull(url);
+ url =3D cm3.getURL("classpath:/org/exoplatform/container/configurati=
on/empty-config.xml");
+ checkURL(url);
+ url =3D cm3.getURL("classpath:/org/exoplatform/container/configurati=
on/empty-config-fake.xml");
+ assertNull(url);
+ try
+ {
+ url =3D cm3.getURL("war:/org/exoplatform/container/configuration/=
empty-config.xml");
+ fail("An error should be thrown");
+ }
+ catch (Exception e)
+ {
+ // ok;
+ }
+ try
+ {
+ url =3D cm3.getURL("war:/org/exoplatform/container/configuration/=
empty-config-fake.xml");
+ fail("An error should be thrown");
+ }
+ catch (Exception e)
+ {
+ // ok;
+ }
+ url =3D cm3.getURL(sURL + "/configuration/empty-config.xml");
+ checkURL(url);
+ url =3D cm3.getURL(sURL + "/configuration/empty-config-fake.xml");
+ checkURL(url, true);
+ url =3D cm3.getURL("configuration/empty-config.xml");
+ checkURL(url);
+ url =3D cm3.getURL("configuration/empty-config-fake.xml");
+ checkURL(url, true); =
+ url =3D cm3.getURL("configuration\\empty-config.xml");
+ checkURL(url);
+ url =3D cm3.getURL("configuration\\empty-config-fake.xml");
+ checkURL(url, true); =
+ }
+
+ public void testGetFileURL() throws Exception
+ {
+ // Empty CM
+ ConfigurationManager cm =3D new ConfigurationManagerImpl();
+ URL url =3D cm.getURL(null);
+ assertNull(url);
+ url =3D cm.getURL("file:F:\\somepath\\path\\configuration.xml");
+ assertEquals("file:/F:/somepath/path/configuration.xml", url.toStrin=
g());
+
+ //make context configuration starting fith "file:D:..."
+ try
+ {
+ cm.addConfiguration("file:D:\\somepath\\config.xml");
+ }
+ catch (Exception e)
+ {
+ // thats is ok, because such config does not exists, =
+ // but ConfigurationManagerInmp.contextPath going to be initializ=
ed
+ // thats all we need to reproduce bug.
+ }
+
+ // now lets check relative url
+ url =3D cm.getURL("configuration.xml");
+ assertEquals("file:/D:/somepath/configuration.xml", url.toString());
+ }
+
+ public void testImport() throws Exception
+ {
+ // no import
+ ConfigurationManager cm =3D new ConfigurationManagerImpl();
+ cm.addConfiguration("classpath:/org/exoplatform/container/configurat=
ion/config-manager-configuration-a.xml");
+ Configuration conf =3D cm.getConfiguration();
+ assertNotNull(conf.getComponent("A"));
+ assertTrue(conf.getComponent("A").getDocumentURL().getFile().endsWit=
h("config-manager-configuration-a.xml"));
+ assertNull(conf.getComponent("B"));
+ assertNull(conf.getComponent("C"));
+ =
+ // b import a
+ cm =3D new ConfigurationManagerImpl();
+ cm.addConfiguration("classpath:/org/exoplatform/container/configurat=
ion/config-manager-configuration-b.xml");
+ conf =3D cm.getConfiguration();
+ assertNotNull(conf.getComponent("A"));
+ assertTrue(conf.getComponent("A").getDocumentURL().getFile().endsWit=
h("config-manager-configuration-a.xml"));
+ assertNotNull(conf.getComponent("B"));
+ assertTrue(conf.getComponent("B").getDocumentURL().getFile().endsWit=
h("config-manager-configuration-b.xml"));
+ assertNull(conf.getComponent("C"));
+ =
+ // c import b and b import a
+ cm =3D new ConfigurationManagerImpl();
+ cm.addConfiguration("classpath:/org/exoplatform/container/configurat=
ion/config-manager-configuration-c.xml");
+ conf =3D cm.getConfiguration();
+ assertNotNull(conf.getComponent("A"));
+ assertTrue(conf.getComponent("A").getDocumentURL().getFile().endsWit=
h("config-manager-configuration-a.xml"));
+ assertNotNull(conf.getComponent("B"));
+ assertTrue(conf.getComponent("B").getDocumentURL().getFile().endsWit=
h("config-manager-configuration-b.xml"));
+ assertNotNull(conf.getComponent("C"));
+ assertTrue(conf.getComponent("C").getDocumentURL().getFile().endsWit=
h("config-manager-configuration-c.xml"));
+ }
+ =
+ private void checkURL(URL url) throws Exception
+ {
+ checkURL(url, false);
+ }
+ =
+ private void checkURL(URL url, boolean empty) throws Exception
+ {
+ assertNotNull(url);
+ InputStream is =3D null;
+ try
+ {
+ is =3D url.openStream();
+ if (empty)
+ {
+ assertNull(is);
+ }
+ else
+ {
+ assertNotNull(is);
+ assertTrue(is.available() > 0); =
+ }
+ }
+ catch (IOException e)
+ {
+ if (empty)
+ {
+ // OK
+ } =
+ else
+ {
+ throw e;
+ }
+ }
+ finally
+ {
+ if (is !=3D null)
+ {
+ try
+ {
+ is.close();
+ }
+ catch (Exception e)
+ {
+ // ignore me
+ }
+ }
+ }
+ }
+ =
+ private static class MockServletContext implements ServletContext
+ {
+
+ public Object getAttribute(String arg0)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Enumeration getAttributeNames()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ServletContext getContext(String arg0)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getContextPath()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getInitParameter(String arg0)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Enumeration getInitParameterNames()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int getMajorVersion()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public String getMimeType(String arg0)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int getMinorVersion()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public RequestDispatcher getNamedDispatcher(String arg0)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getRealPath(String arg0)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public RequestDispatcher getRequestDispatcher(String arg0)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public URL getResource(String arg0) throws MalformedURLException
+ {
+ // We remove "/WEB-INF/
+ String path =3D arg0.substring(ConfigurationManagerImpl.WAR_CONF_=
LOCATION.length() + 1);
+ return Thread.currentThread().getContextClassLoader().getResource=
(path);
+ }
+
+ public InputStream getResourceAsStream(String arg0)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Set getResourcePaths(String arg0)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getServerInfo()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Servlet getServlet(String arg0) throws ServletException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getServletContextName()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Enumeration getServletNames()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Enumeration getServlets()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void log(String arg0)
+ {
+ // TODO Auto-generated method stub
+ =
+ }
+
+ public void log(Exception arg0, String arg1)
+ {
+ // TODO Auto-generated method stub
+ =
+ }
+
+ public void log(String arg0, Throwable arg1)
+ {
+ // TODO Auto-generated method stub
+ =
+ }
+
+ public void removeAttribute(String arg0)
+ {
+ // TODO Auto-generated method stub
+ =
+ }
+
+ public void setAttribute(String arg0, Object arg1)
+ {
+ // TODO Auto-generated method stub
+ =
+ }
+ =
+ }
+}
--===============1380720962590770355==--
From do-not-reply at jboss.org Tue Oct 5 03:16:07 2010
Content-Type: multipart/mixed; boundary="===============3220632597538394219=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3239 -
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup.
Date: Tue, 05 Oct 2010 03:16:07 -0400
Message-ID: <201010050716.o957G7hw013630@svn01.web.mwc.hst.phx2.redhat.com>
--===============3220632597538394219==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: tolusha
Date: 2010-10-05 03:16:06 -0400 (Tue, 05 Oct 2010)
New Revision: 3239
Modified:
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/=
modules/jcr/backup/backup-client.xml
Log:
EXOJCR-946: Adopt Backup client article
Modified: jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook=
/en-US/modules/jcr/backup/backup-client.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US=
/modules/jcr/backup/backup-client.xml 2010-10-04 14:48:42 UTC (rev 3238)
+++ jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US=
/modules/jcr/backup/backup-client.xml 2010-10-05 07:16:06 UTC (rev 3239)
@@ -976,16 +976,16 @@
Go to folder of "backup client" ../jcr/trunk/applications/java/standalone/backupco=
nsole
+ role=3D"bold">../jcr/trunk/applications/exo.jcr.applications.bac=
kupconsole
. - build the application :
- mvn clean install
+ mvn clean install -P deploy
=
=
Go to ../jcr/trunk/applications/java/standalone/backupco=
nsole/target/backupconsole-binary
+ role=3D"bold">../jcr/trunk/applications/exo.jcr.applications.bac=
kupconsole/target/backupconsole-binary
and use it.
@@ -996,7 +996,7 @@
=
- Run jarjava -jar exo.jcr.applications.back=
upconsole-1.11.1-SNAPSHOT.jar <command>
+ Run jarjava -jar exo.jcr.applications.back=
upconsole-binary.jar <command>
or use jcrbackup.cmd (or .sh);
--===============3220632597538394219==--
From do-not-reply at jboss.org Tue Oct 5 03:16:36 2010
Content-Type: multipart/mixed; boundary="===============0287915629031737219=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3240 -
jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup.
Date: Tue, 05 Oct 2010 03:16:36 -0400
Message-ID: <201010050716.o957Ga2Z013679@svn01.web.mwc.hst.phx2.redhat.com>
--===============0287915629031737219==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: tolusha
Date: 2010-10-05 03:16:35 -0400 (Tue, 05 Oct 2010)
New Revision: 3240
Modified:
jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docb=
ook/en-US/modules/jcr/backup/backup-client.xml
Log:
EXOJCR-946: Adopt Backup client article
Modified: jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/ma=
in/docbook/en-US/modules/jcr/backup/backup-client.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/doc=
book/en-US/modules/jcr/backup/backup-client.xml 2010-10-05 07:16:06 UTC (re=
v 3239)
+++ jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/doc=
book/en-US/modules/jcr/backup/backup-client.xml 2010-10-05 07:16:35 UTC (re=
v 3240)
@@ -976,16 +976,16 @@
Go to folder of "backup client" ../jcr/trunk/applications/java/standalone/backupco=
nsole
+ role=3D"bold">../jcr/trunk/applications/exo.jcr.applications.bac=
kupconsole
. - build the application :
- mvn clean install
+ mvn clean install -P deploy
=
=
Go to ../jcr/trunk/applications/java/standalone/backupco=
nsole/target/backupconsole-binary
+ role=3D"bold">../jcr/trunk/applications/exo.jcr.applications.bac=
kupconsole/target/backupconsole-binary
and use it.
@@ -996,7 +996,7 @@
=
- Run jarjava -jar exo.jcr.applications.back=
upconsole-1.11.1-SNAPSHOT.jar <command>
+ Run jarjava -jar exo.jcr.applications.back=
upconsole-binary.jar <command>
or use jcrbackup.cmd (or .sh);
--===============0287915629031737219==--
From do-not-reply at jboss.org Tue Oct 5 05:03:50 2010
Content-Type: multipart/mixed; boundary="===============7203254911195392084=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3241 - in
jcr/trunk/exo.jcr.connectors.localadapter: src/main/rar/META-INF and 1 other
directory.
Date: Tue, 05 Oct 2010 05:03:49 -0400
Message-ID: <201010050903.o9593nLB030444@svn01.web.mwc.hst.phx2.redhat.com>
--===============7203254911195392084==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: tolusha
Date: 2010-10-05 05:03:49 -0400 (Tue, 05 Oct 2010)
New Revision: 3241
Modified:
jcr/trunk/exo.jcr.connectors.localadapter/pom.xml
jcr/trunk/exo.jcr.connectors.localadapter/src/main/rar/META-INF/ra.xml
Log:
EXOJCR-949: Updating eXo JCR version in ra.xml automatically
Modified: jcr/trunk/exo.jcr.connectors.localadapter/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/trunk/exo.jcr.connectors.localadapter/pom.xml 2010-10-05 07:16:35 U=
TC (rev 3240)
+++ jcr/trunk/exo.jcr.connectors.localadapter/pom.xml 2010-10-05 09:03:49 U=
TC (rev 3241)
@@ -121,6 +121,13 @@
+
+
+ src/main/rar
+ ${project.build.directory}
+ true
+
+
org.apache.maven.plugins
@@ -146,6 +153,7 @@
org.apache.maven.plugins
maven-rar-plugin
+ ${project.build.directory}/META-INF/ra.xml
true
Modified: jcr/trunk/exo.jcr.connectors.localadapter/src/main/rar/META-INF/r=
a.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/trunk/exo.jcr.connectors.localadapter/src/main/rar/META-INF/ra.xml =
2010-10-05 07:16:35 UTC (rev 3240)
+++ jcr/trunk/exo.jcr.connectors.localadapter/src/main/rar/META-INF/ra.xml =
2010-10-05 09:03:49 UTC (rev 3241)
@@ -25,7 +25,7 @@
JCR repository
exoplatform
- 1.14.0-CR1-SNAPSHOT
+ ${project.version}
false
--===============7203254911195392084==--
From do-not-reply at jboss.org Tue Oct 5 06:36:49 2010
Content-Type: multipart/mixed; boundary="===============8440882601717688010=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3242 - in
jcr/branches/1.12.x/exo.jcr.connectors.localadapter: src/main/rar/META-INF
and 1 other directory.
Date: Tue, 05 Oct 2010 06:36:48 -0400
Message-ID: <201010051036.o95AamKw008238@svn01.web.mwc.hst.phx2.redhat.com>
--===============8440882601717688010==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: tolusha
Date: 2010-10-05 06:36:48 -0400 (Tue, 05 Oct 2010)
New Revision: 3242
Modified:
jcr/branches/1.12.x/exo.jcr.connectors.localadapter/pom.xml
jcr/branches/1.12.x/exo.jcr.connectors.localadapter/src/main/rar/META-IN=
F/ra.xml
Log:
JCR-1471: Updating eXo JCR version in ra.xml automatically
Modified: jcr/branches/1.12.x/exo.jcr.connectors.localadapter/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.connectors.localadapter/pom.xml 2010-10-05 =
09:03:49 UTC (rev 3241)
+++ jcr/branches/1.12.x/exo.jcr.connectors.localadapter/pom.xml 2010-10-05 =
10:36:48 UTC (rev 3242)
@@ -121,6 +121,13 @@
+
+
+ src/main/rar
+ ${project.build.directory}
+ true
+
+
org.apache.maven.plugins
@@ -146,6 +153,7 @@
org.apache.maven.plugins
maven-rar-plugin
+ ${project.build.directory}/META-INF/ra.xml
true
Modified: jcr/branches/1.12.x/exo.jcr.connectors.localadapter/src/main/rar/=
META-INF/ra.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.connectors.localadapter/src/main/rar/META-I=
NF/ra.xml 2010-10-05 09:03:49 UTC (rev 3241)
+++ jcr/branches/1.12.x/exo.jcr.connectors.localadapter/src/main/rar/META-I=
NF/ra.xml 2010-10-05 10:36:48 UTC (rev 3242)
@@ -25,7 +25,7 @@
JCR repository
exoplatform
- 1.12.5-GA-SNAPSHOT
+ ${project.version}
false
--===============8440882601717688010==--
From do-not-reply at jboss.org Tue Oct 5 07:04:55 2010
Content-Type: multipart/mixed; boundary="===============7220160634602834517=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3243 -
jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup.
Date: Tue, 05 Oct 2010 07:04:55 -0400
Message-ID: <201010051104.o95B4tvk014898@svn01.web.mwc.hst.phx2.redhat.com>
--===============7220160634602834517==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: tolusha
Date: 2010-10-05 07:04:54 -0400 (Tue, 05 Oct 2010)
New Revision: 3243
Modified:
jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docb=
ook/en-US/modules/jcr/backup/backup-client.xml
Log:
JCR-1472: revert doc changes
Modified: jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/ma=
in/docbook/en-US/modules/jcr/backup/backup-client.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/doc=
book/en-US/modules/jcr/backup/backup-client.xml 2010-10-05 10:36:48 UTC (re=
v 3242)
+++ jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/doc=
book/en-US/modules/jcr/backup/backup-client.xml 2010-10-05 11:04:54 UTC (re=
v 3243)
@@ -976,16 +976,16 @@
Go to folder of "backup client" ../jcr/trunk/applications/exo.jcr.applications.bac=
kupconsole
+ role=3D"bold">../jcr/trunk/applications/java/standalone/backupco=
nsole
. - build the application :
- mvn clean install -P deploy
+ mvn clean install
=
=
Go to ../jcr/trunk/applications/exo.jcr.applications.bac=
kupconsole/target/backupconsole-binary
+ role=3D"bold">../jcr/trunk/applications/java/standalone/backupco=
nsole/target/backupconsole-binary
and use it.
@@ -996,7 +996,7 @@
=
- Run jarjava -jar exo.jcr.applications.back=
upconsole-binary.jar <command>
+ Run jarjava -jar exo.jcr.applications.back=
upconsole-1.11.1-SNAPSHOT.jar <command>
or use jcrbackup.cmd (or .sh);
--===============7220160634602834517==--
From do-not-reply at jboss.org Tue Oct 5 07:32:44 2010
Content-Type: multipart/mixed; boundary="===============4479141262096130249=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3244 -
jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup.
Date: Tue, 05 Oct 2010 07:32:44 -0400
Message-ID: <201010051132.o95BWiJX016338@svn01.web.mwc.hst.phx2.redhat.com>
--===============4479141262096130249==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: tolusha
Date: 2010-10-05 07:32:43 -0400 (Tue, 05 Oct 2010)
New Revision: 3244
Modified:
jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docb=
ook/en-US/modules/jcr/backup/backup-client.xml
Log:
JCR-1471: Adopt Backup client article
Modified: jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/ma=
in/docbook/en-US/modules/jcr/backup/backup-client.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/doc=
book/en-US/modules/jcr/backup/backup-client.xml 2010-10-05 11:04:54 UTC (re=
v 3243)
+++ jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/doc=
book/en-US/modules/jcr/backup/backup-client.xml 2010-10-05 11:32:43 UTC (re=
v 3244)
@@ -976,19 +976,23 @@
Go to folder of "backup client" ../jcr/trunk/applications/java/standalone/backupco=
nsole
+ role=3D"bold">${JCR-SRC-HOME}/applications/exo.jcr.applications.=
backupconsole
. - build the application :
- mvn clean install
+ mvn clean install -P deploy
=
=
Go to ../jcr/trunk/applications/java/standalone/backupco=
nsole/target/backupconsole-binary
+ role=3D"bold">${JCR-SRC-HOME}/applications/exo.jcr.applications.=
backupconsole/target/backupconsole-binary
and use it.
+
+
+ ${JCR-SRC-HOME} the path =
where eXo JCR sources located
+
=
@@ -996,7 +1000,7 @@
=
- Run jarjava -jar exo.jcr.applications.back=
upconsole-1.11.1-SNAPSHOT.jar <command>
+ Run jarjava -jar exo.jcr.applications.back=
upconsole-binary.jar <command>
or use jcrbackup.cmd (or .sh);
--===============4479141262096130249==--
From do-not-reply at jboss.org Tue Oct 5 07:33:25 2010
Content-Type: multipart/mixed; boundary="===============4614887042164204393=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3245 -
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup.
Date: Tue, 05 Oct 2010 07:33:25 -0400
Message-ID: <201010051133.o95BXPa6016352@svn01.web.mwc.hst.phx2.redhat.com>
--===============4614887042164204393==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: tolusha
Date: 2010-10-05 07:33:24 -0400 (Tue, 05 Oct 2010)
New Revision: 3245
Modified:
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/=
modules/jcr/backup/backup-client.xml
Log:
EXOJCR-946: Adopt Backup client article
Modified: jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook=
/en-US/modules/jcr/backup/backup-client.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US=
/modules/jcr/backup/backup-client.xml 2010-10-05 11:32:43 UTC (rev 3244)
+++ jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US=
/modules/jcr/backup/backup-client.xml 2010-10-05 11:33:24 UTC (rev 3245)
@@ -976,7 +976,7 @@
Go to folder of "backup client" ../jcr/trunk/applications/exo.jcr.applications.bac=
kupconsole
+ role=3D"bold">${JCR-SRC-HOME}/applications/exo.jcr.applications.=
backupconsole
. - build the application :
mvn clean install -P deploy
=
@@ -985,10 +985,14 @@
=
Go to ../jcr/trunk/applications/exo.jcr.applications.bac=
kupconsole/target/backupconsole-binary
+ role=3D"bold">${JCR-SRC-HOME}/applications/exo.jcr.applications.=
backupconsole/target/backupconsole-binary
and use it.
+
+
+ ${JCR-SRC-HOME} the path =
where eXo JCR sources located
+
=
--===============4614887042164204393==--
From do-not-reply at jboss.org Tue Oct 5 10:59:11 2010
Content-Type: multipart/mixed; boundary="===============0938029445778835888=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3246 - in ws/trunk:
exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/frameworks/json and 5
other directories.
Date: Tue, 05 Oct 2010 10:59:11 -0400
Message-ID: <201010051459.o95ExBvX011600@svn01.web.mwc.hst.phx2.redhat.com>
--===============0938029445778835888==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: aparfonov
Date: 2010-10-05 10:59:07 -0400 (Tue, 05 Oct 2010)
New Revision: 3246
Added:
ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/framewo=
rks/json/impl/JsonStack.java
ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/framewo=
rks/json/impl/ObjectBuilder.java
ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framewo=
rks/json/impl/JsonTest.java
ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framewo=
rks/json/impl/ObjectBuilderTest.java
ws/trunk/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/im=
pl/provider/JsonEntityTest.java
Removed:
ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framewo=
rks/json/impl/JavaNumericTypeTest.java
ws/trunk/exo.ws.frameworks.json/src/test/resources/MultiDimension.txt
ws/trunk/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/im=
pl/provider/JsonEntityTest.java
Modified:
ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/framewo=
rks/json/impl/BeanBuilder.java
ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/framewo=
rks/json/impl/JsonDefaultHandler.java
ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/framewo=
rks/json/impl/JsonGeneratorImpl.java
ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/framewo=
rks/json/impl/JsonParserImpl.java
ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/framewo=
rks/json/impl/JsonUtils.java
ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/framewo=
rks/json/impl/JsonWriterImpl.java
ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framewo=
rks/json/Book.java
ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framewo=
rks/json/impl/JsonGeneratorTest.java
ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framewo=
rks/json/impl/JsonParserTest.java
ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framewo=
rks/json/impl/JsonUtilsTest.java
ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framewo=
rks/json/impl/JsonWriterTest.java
ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framewo=
rks/json/impl/TransferJavaBeanTest.java
ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framewo=
rks/json/impl/groovy/GroovyBeanTest.java
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/im=
pl/provider/JsonEntityProvider.java
Log:
EXOJCR-989
Modified: ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/=
frameworks/json/impl/BeanBuilder.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/framew=
orks/json/impl/BeanBuilder.java 2010-10-05 11:33:24 UTC (rev 3245)
+++ ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/framew=
orks/json/impl/BeanBuilder.java 2010-10-05 14:59:07 UTC (rev 3246)
@@ -18,506 +18,27 @@
*/
package org.exoplatform.ws.frameworks.json.impl;
=
-import org.exoplatform.ws.frameworks.json.impl.JsonUtils.Types;
import org.exoplatform.ws.frameworks.json.value.JsonValue;
=
-import java.lang.reflect.Array;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.Map;
-
/**
* @author Andrey Parfonov
* @version $Id: BeanBuilder.java 34417 2009-07-23 14:42:56Z dkatayev $
+ * @deprecated use {@link ObjectBuilder#createObject(Class, JsonValue)} in=
stead
*/
public class BeanBuilder
{
=
- static final Collection SKIP_METHODS =3D new HashSet();
-
- static
- {
- // Since we need support for Groovy must skip this.
- // All "Groovy Objects" implements interface groovy.lang.GroovyObject
- // and has method setMetaClass. Not need to process it.
- SKIP_METHODS.add("setMetaClass");
- }
-
/**
- * Create Java Bean from Json Source.
+ * Create Java Bean from JSON Source.
*
* @param clazz the Class of target Object.
- * @param jsonValue the Json representation.
+ * @param jsonValue the JSON representation.
* @return Object.
* @throws Exception if any errors occurs.
*/
- @SuppressWarnings("unchecked")
public Object createObject(Class> clazz, JsonValue jsonValue) throws =
Exception
{
- if (JsonUtils.getType(clazz) =3D=3D Types.ENUM)
- {
- // Enum is not instantiable via CLass.getInstance().
- // This is used when enum is member of array or collection.
- Class c =3D clazz;
- return Enum.valueOf(c, jsonValue.getStringValue());
- }
- Object object =3D clazz.newInstance();
- Method[] methods =3D clazz.getMethods();
-
- for (Method method : methods)
- {
- String methodName =3D method.getName();
- Class>[] parameterTypes =3D method.getParameterTypes();
-
- if (!SKIP_METHODS.contains(methodName) && methodName.startsWith("=
set") && parameterTypes.length =3D=3D 1
- && methodName.length() > 3)
- {
- Class> methodParameterClazz =3D parameterTypes[0];
- String key =3D methodName.substring(3);
- // first letter to lower case
- key =3D (key.length() > 1) ? Character.toLowerCase(key.charAt(=
0)) + key.substring(1) : key.toLowerCase();
-
- // Bug : WS-53
- if (jsonValue.isNull())
- {
- return null;
- }
-
- if (!jsonValue.isObject())
- {
- throw new JsonException("Unsupported type of jsonValue for =
parameter of method " + clazz.getName() + "#"
- + method.getName());
- }
-
- JsonValue childJsonValue =3D jsonValue.getElement(key);
-
- if (childJsonValue =3D=3D null)
- {
- continue;
- }
-
- // if one of known primitive type or array of primitive type
- if (JsonUtils.isKnownType(methodParameterClazz))
- {
- method.invoke(object, new Object[]{createObjectKnownTypes(m=
ethodParameterClazz, childJsonValue)});
- }
- else
- {
- Types type =3D JsonUtils.getType(methodParameterClazz);
- // other type Collection, Map or Object[].
- if (type !=3D null)
- {
- switch (type)
- {
- case ENUM : {
- Class c =3D methodParameterClazz;
- Enum> en =3D Enum.valueOf(c, childJsonValue.getS=
tringValue());
- method.invoke(object, new Object[]{en});
- }
- break;
- case ARRAY_OBJECT : {
- Object array =3D createArray(methodParameterClazz,=
childJsonValue);
- method.invoke(object, new Object[]{array});
- }
- break;
- case COLLECTION : {
- Type[] genericParameterTypes =3D method.getGeneric=
ParameterTypes();
- Class> parameterizedTypeClass =3D null;
- if (genericParameterTypes.length =3D=3D 1)
- {
- if (genericParameterTypes[0] instanceof Paramet=
erizedType)
- {
- ParameterizedType parameterizedType =3D (Par=
ameterizedType)genericParameterTypes[0];
- try
- {
- // Collection can't be parameterized by o=
ther Collection,
- // Array, etc.
- parameterizedTypeClass =3D (Class>)para=
meterizedType.getActualTypeArguments()[0];
- }
- catch (ClassCastException e)
- {
- throw new JsonException("Unsupported para=
meter in method " + clazz.getName() + "#"
- + method.getName()
- + ". This type of Collection can't be =
restored from JSON source.\n"
- + "Collection is parameterized by wron=
g Type: " + parameterizedType + ".");
- }
- }
- else
- {
- throw new JsonException("Unsupported paramet=
er in method " + clazz.getName() + "#"
- + method.getName() + ". Collection is not=
parameterized. "
- + "Collection> is not supported. \nColl=
ection must be parameterized by"
- + " any types, or by JavaBean with 'get' =
and 'set' methods.");
- }
- }
- Constructor> constructor =3D null;
- if (methodParameterClazz.isInterface()
- || Modifier.isAbstract(methodParameterClazz.get=
Modifiers()))
- {
- try
- {
- constructor =3D
- ArrayList.class.asSubclass(methodParamete=
rClazz).getConstructor(
- new Class[]{Collection.class});
- }
- catch (Exception e)
- {
- try
- {
- constructor =3D
- HashSet.class.asSubclass(methodParamet=
erClazz).getConstructor(
- new Class[]{Collection.class});
- }
- catch (Exception e1)
- {
- try
- {
- constructor =3D
- LinkedList.class.asSubclass(methodP=
arameterClazz).getConstructor(
- new Class[]{Collection.class});
- }
- catch (Exception e2)
- {
- // ignore exception here
- }
- }
- }
- }
- else
- {
- constructor =3D methodParameterClazz.getConstru=
ctor(new Class[]{Collection.class});
- }
- if (constructor =3D=3D null)
- {
- throw new JsonException("Can't find satisfied c=
onstructor for : " + methodParameterClazz
- + ", method : " + clazz.getName() + "#" + me=
thod.getName());
- }
-
- ArrayList sourceCollection =3D new ArrayLi=
st(childJsonValue.size());
-
- Iterator values =3D childJsonValue.getE=
lements();
-
- while (values.hasNext())
- {
- JsonValue v =3D values.next();
- if (!JsonUtils.isKnownType(parameterizedTypeCla=
ss))
- {
- sourceCollection.add(createObject(parameteri=
zedTypeClass, v));
- }
- else
- {
- sourceCollection.add(createObjectKnownTypes(=
parameterizedTypeClass, v));
- }
- }
-
- constructor.newInstance(sourceCollection);
- method.invoke(object, constructor.newInstance(sour=
ceCollection));
- }
- break;
- case MAP : {
- Type[] genericParameterTypes =3D method.getGeneric=
ParameterTypes();
- Class> parameterizedTypeClass =3D null;
- if (genericParameterTypes.length =3D=3D 1)
- {
- if (genericParameterTypes[0] instanceof Paramet=
erizedType)
- {
- ParameterizedType parameterizedType =3D (Par=
ameterizedType)genericParameterTypes[0];
- if (!String.class
- .isAssignableFrom((Class>)parameterized=
Type.getActualTypeArguments()[0]))
- {
- throw new JsonException("Unsupported para=
meter in method " + clazz.getName() + "#"
- + method.getName() + ". Key of Map mus=
t be String.");
- }
- try
- {
- parameterizedTypeClass =3D (Class>)para=
meterizedType.getActualTypeArguments()[1];
- }
- catch (Exception e)
- {
- throw new JsonException("Unsupported para=
meter in method " + clazz.getName() + "#"
- + method.getName() + ". This type of M=
ap can't be restored from JSON source.\n"
- + "Map is parameterized by wrong Type:=
" + parameterizedType + ".");
- }
- }
- else
- {
- throw new JsonException("Unsupported paramet=
er in method " + clazz.getName() + "#"
- + method.getName() + ". Map is not parame=
terized. "
- + "Map is not supported. \nMap =
must be parameterized by"
- + "String and any types or JavaBean with =
'get' and 'set' methods.");
- }
- }
- Constructor> constructor =3D null;
- if (methodParameterClazz.isInterface()
- || Modifier.isAbstract(methodParameterClazz.get=
Modifiers()))
- {
- try
- {
- constructor =3D
- HashMap.class.asSubclass(methodParameterC=
lazz).getConstructor(new Class[]{Map.class});
- }
- catch (Exception e)
- {
- try
- {
- constructor =3D
- Hashtable.class.asSubclass(methodParam=
eterClazz).getConstructor(
- new Class[]{Map.class});
- }
- catch (Exception e1)
- {
- try
- {
- constructor =3D
- LinkedHashMap.class.asSubclass(meth=
odParameterClazz).getConstructor(
- new Class[]{Map.class});
- }
- catch (Exception e2)
- {
- // ignore exception here
- }
- }
- }
- }
- else
- {
- constructor =3D methodParameterClazz.getConstru=
ctor(new Class[]{Map.class});
- }
-
- if (constructor =3D=3D null)
- {
- throw new JsonException("Can't find satisfied c=
onstructor for : " + methodParameterClazz
- + ", method : " + clazz.getName() + "#" + me=
thod.getName());
- }
-
- HashMap sourceMap =3D new HashMap<=
String, Object>(childJsonValue.size());
-
- Iterator keys =3D childJsonValue.getKeys();
-
- while (keys.hasNext())
- {
- String k =3D keys.next();
- JsonValue v =3D childJsonValue.getElement(k);
- if (!JsonUtils.isKnownType(parameterizedTypeCla=
ss))
- {
- sourceMap.put(k, createObject(parameterizedT=
ypeClass, v));
- }
- else
- {
- sourceMap.put(k, createObjectKnownTypes(para=
meterizedTypeClass, v));
- }
- }
-
- method.invoke(object, constructor.newInstance(sour=
ceMap));
-
- }
- break;
- default :
- // it must never happen!
- throw new JsonException("Can't restore parameter o=
f method : " + clazz.getName() + "#"
- + method.getName() + " from JSON source.");
- }
-
- }
- else
- {
- method.invoke(object, createObject(methodParameterClazz,=
childJsonValue));
- }
- }
- }
- }
-
- return object;
+ return ObjectBuilder.createObject(clazz, jsonValue);
}
=
- /**
- * Create array of Java Object from Json Source include multi-dimension
- * array.
- *
- * @param clazz the Class of target Object.
- * @param jsonValue the Json representation.
- * @return Object.
- * @throws Exception if any errors occurs.
- */
- private Object createArray(Class> clazz, JsonValue jsonValue) throws =
Exception
- {
-
- Class> componentType =3D clazz.getComponentType();
- Object array =3D Array.newInstance(componentType, jsonValue.size());
- Iterator values =3D jsonValue.getElements();
- int i =3D 0;
-
- if (componentType.isArray())
- {
- if (JsonUtils.isKnownType(componentType))
- {
- while (values.hasNext())
- {
- JsonValue v =3D values.next();
- Array.set(array, i++, createObjectKnownTypes(componentType,=
v));
- }
- }
- else
- {
- while (values.hasNext())
- {
- JsonValue v =3D values.next();
- Array.set(array, i++, createArray(componentType, v));
- }
- }
- }
- else
- {
- while (values.hasNext())
- {
- JsonValue v =3D values.next();
- Array.set(array, i++, createObject(componentType, v));
- }
- }
- return array;
- }
-
- /**
- * Create Objects of known types.
- *
- * @param clazz class.
- * @param jsonValue JsonValue , @see {@link JsonValue}
- * @return Object.
- * @throws JsonException if type is unknown.
- */
- private Object createObjectKnownTypes(Class> clazz, JsonValue jsonVal=
ue) throws JsonException
- {
- Types t =3D JsonUtils.getType(clazz);
- switch (t)
- {
- case NULL :
- return null;
- case BOOLEAN :
- return jsonValue.getBooleanValue();
- case BYTE :
- return jsonValue.getByteValue();
- case SHORT :
- return jsonValue.getShortValue();
- case INT :
- return jsonValue.getIntValue();
- case LONG :
- return jsonValue.getLongValue();
- case FLOAT :
- return jsonValue.getFloatValue();
- case DOUBLE :
- return jsonValue.getDoubleValue();
- case CHAR :
- // TODO check String length
- return jsonValue.getStringValue().charAt(0);
- case STRING :
- return jsonValue.getStringValue();
- case ARRAY_BOOLEAN : {
- boolean[] params =3D new boolean[jsonValue.size()];
- Iterator values =3D jsonValue.getElements();
- int i =3D 0;
- while (values.hasNext())
- {
- params[i++] =3D values.next().getBooleanValue();
- }
- return params;
- }
- case ARRAY_BYTE : {
- byte[] params =3D new byte[jsonValue.size()];
- Iterator values =3D jsonValue.getElements();
- int i =3D 0;
- while (values.hasNext())
- {
- params[i++] =3D values.next().getByteValue();
- }
- return params;
- }
- case ARRAY_SHORT : {
- short[] params =3D new short[jsonValue.size()];
- Iterator values =3D jsonValue.getElements();
- int i =3D 0;
- while (values.hasNext())
- {
- params[i++] =3D values.next().getShortValue();
- }
- return params;
- }
- case ARRAY_INT : {
- int[] params =3D new int[jsonValue.size()];
- Iterator values =3D jsonValue.getElements();
- int i =3D 0;
- while (values.hasNext())
- {
- params[i++] =3D values.next().getIntValue();
- }
- return params;
- }
- case ARRAY_LONG : {
- long[] params =3D new long[jsonValue.size()];
- Iterator values =3D jsonValue.getElements();
- int i =3D 0;
- while (values.hasNext())
- {
- params[i++] =3D values.next().getLongValue();
- }
- return params;
- }
- case ARRAY_FLOAT : {
- float[] params =3D new float[jsonValue.size()];
- Iterator values =3D jsonValue.getElements();
- int i =3D 0;
- while (values.hasNext())
- {
- params[i++] =3D values.next().getFloatValue();
- }
- return params;
- }
- case ARRAY_DOUBLE : {
- double[] params =3D new double[jsonValue.size()];
- Iterator values =3D jsonValue.getElements();
- int i =3D 0;
- while (values.hasNext())
- {
- params[i++] =3D values.next().getDoubleValue();
- }
- return params;
- }
- case ARRAY_CHAR : {
- char[] params =3D new char[jsonValue.size()];
- Iterator values =3D jsonValue.getElements();
- int i =3D 0;
- // TODO better checking an transformation string to char
- while (values.hasNext())
- {
- params[i++] =3D values.next().getStringValue().charAt(0);
- }
- return params;
- }
- case ARRAY_STRING : {
- String[] params =3D new String[jsonValue.size()];
- Iterator values =3D jsonValue.getElements();
- int i =3D 0;
- while (values.hasNext())
- {
- params[i++] =3D values.next().getStringValue();
- }
- return params;
- }
- default :
- // Nothing to do for other type. Exception will be thrown.
- break;
- }
- throw new JsonException("Unknown type " + clazz.getName());
- }
-
}
Modified: ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/=
frameworks/json/impl/JsonDefaultHandler.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/framew=
orks/json/impl/JsonDefaultHandler.java 2010-10-05 11:33:24 UTC (rev 3245)
+++ ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/framew=
orks/json/impl/JsonDefaultHandler.java 2010-10-05 14:59:07 UTC (rev 3246)
@@ -28,8 +28,6 @@
import org.exoplatform.ws.frameworks.json.value.impl.ObjectValue;
import org.exoplatform.ws.frameworks.json.value.impl.StringValue;
=
-import java.util.Stack;
-
/**
* @author Andrey Parfonov
* @version $Id: JsonDefaultHandler.java 34417 2009-07-23 14:42:56Z dkatay=
ev $
@@ -37,27 +35,19 @@
public class JsonDefaultHandler implements JsonHandler
{
=
- /**
- * The key.
- */
+ /** The key. */
private String key;
=
- /**
- * JsonValue which is currently in process.
- */
+ /** JsonValue which is currently in process. */
private JsonValue current;
=
- /**
- * Stack of JsonValues.
- */
- private Stack values;
+ /** Stack of JsonValues. */
+ private JsonStack values;
=
- /**
- * Constructs new JsonHandler.
- */
+ /** Constructs new JsonHandler. */
public JsonDefaultHandler()
{
- this.values =3D new Stack();
+ this.values =3D new JsonStack();
}
=
/**
@@ -66,9 +56,13 @@
public void characters(char[] characters)
{
if (current.isObject())
+ {
current.addElement(key, parseCharacters(characters));
+ }
else if (current.isArray())
+ {
current.addElement(parseCharacters(characters));
+ }
}
=
/**
@@ -101,10 +95,18 @@
public void startArray()
{
ArrayValue o =3D new ArrayValue();
- if (current.isObject())
+ if (current =3D=3D null)
+ {
+ current =3D o;
+ }
+ else if (current.isObject())
+ {
current.addElement(key, o);
+ }
else if (current.isArray())
+ {
current.addElement(o);
+ }
values.push(current);
current =3D o;
}
@@ -122,14 +124,28 @@
}
ObjectValue o =3D new ObjectValue();
if (current.isObject())
+ {
current.addElement(key, o);
+ }
else if (current.isArray())
+ {
current.addElement(o);
+ }
values.push(current);
current =3D o;
}
=
/**
+ * Reset JSON events handler and prepare it for next usage.
+ */
+ public void reset()
+ {
+ current =3D null;
+ key =3D null;
+ values.clear();
+ }
+
+ /**
* {@inheritDoc}
*/
public JsonValue getJsonObject()
@@ -139,13 +155,13 @@
=
/**
* Parse characters array dependent of context.
+ *
* @param characters the characters array.
* @return JsonValue.
*/
private JsonValue parseCharacters(char[] characters)
{
String s =3D new String(characters);
-
if (characters[0] =3D=3D '"' && characters[characters.length - 1] =
=3D=3D '"')
{
return new StringValue(s.substring(1, s.length() - 1));
@@ -232,9 +248,6 @@
}
}
// if can't parse return as string
- /////////////////////////////////////////////
- //TODO may be better generate exception here
- /////////////////////////////////////////////
return new StringValue(s);
}
=
Modified: ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/=
frameworks/json/impl/JsonGeneratorImpl.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/framew=
orks/json/impl/JsonGeneratorImpl.java 2010-10-05 11:33:24 UTC (rev 3245)
+++ ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/framew=
orks/json/impl/JsonGeneratorImpl.java 2010-10-05 14:59:07 UTC (rev 3246)
@@ -71,23 +71,7 @@
*/
public JsonValue createJsonArray(Collection> collection) throws JsonE=
xception
{
- if (collection =3D=3D null)
- return new NullValue();
-
- JsonValue jsonArray =3D new ArrayValue();
- for (Object o : collection)
- {
- // If :
- // 1. Known types (primitive, String, array of primitive or Strin=
g)
- // 2. Array of any object (expect for Java Bean)
- // 3. Collection>
- // 4. Map
- if (JsonUtils.getType(o) !=3D null)
- jsonArray.addElement(createJsonValue(o));
- else
- jsonArray.addElement(createJsonObject(o));
- }
- return jsonArray;
+ return createJsonValue(collection);
}
=
/**
@@ -101,77 +85,20 @@
public JsonValue createJsonArray(Object array) throws JsonException
{
if (array =3D=3D null)
+ {
return new NullValue();
-
+ }
Types t =3D JsonUtils.getType(array);
- JsonValue jsonArray =3D new ArrayValue();
- int length =3D Array.getLength(array);
- if (t =3D=3D Types.ARRAY_BOOLEAN)
+ if (t =3D=3D Types.ARRAY_BOOLEAN || t =3D=3D Types.ARRAY_BYTE || t =
=3D=3D Types.ARRAY_SHORT || t =3D=3D Types.ARRAY_INT
+ || t =3D=3D Types.ARRAY_LONG || t =3D=3D Types.ARRAY_FLOAT || t =
=3D=3D Types.ARRAY_DOUBLE || t =3D=3D Types.ARRAY_CHAR
+ || t =3D=3D Types.ARRAY_STRING || t =3D=3D Types.ARRAY_OBJECT)
{
- for (int i =3D 0; i < length; i++)
- jsonArray.addElement(new BooleanValue(Array.getBoolean(array, =
i)));
+ return createJsonValue(array);
}
- else if (t =3D=3D Types.ARRAY_BYTE)
- {
- for (int i =3D 0; i < length; i++)
- jsonArray.addElement(new LongValue(Array.getByte(array, i)));
- }
- else if (t =3D=3D Types.ARRAY_SHORT)
- {
- for (int i =3D 0; i < length; i++)
- jsonArray.addElement(new LongValue(Array.getShort(array, i)));
- }
- else if (t =3D=3D Types.ARRAY_INT)
- {
- for (int i =3D 0; i < length; i++)
- jsonArray.addElement(new LongValue(Array.getInt(array, i)));
- }
- else if (t =3D=3D Types.ARRAY_LONG)
- {
- for (int i =3D 0; i < length; i++)
- jsonArray.addElement(new LongValue(Array.getLong(array, i)));
- }
- else if (t =3D=3D Types.ARRAY_FLOAT)
- {
- for (int i =3D 0; i < length; i++)
- jsonArray.addElement(new DoubleValue(Array.getFloat(array, i))=
);
- }
- else if (t =3D=3D Types.ARRAY_DOUBLE)
- {
- for (int i =3D 0; i < length; i++)
- jsonArray.addElement(new DoubleValue(Array.getDouble(array, i)=
));
- }
- else if (t =3D=3D Types.ARRAY_CHAR)
- {
- for (int i =3D 0; i < length; i++)
- jsonArray.addElement(new StringValue(Character.toString(Array.=
getChar(array, i))));
- }
- else if (t =3D=3D Types.ARRAY_STRING)
- {
- for (int i =3D 0; i < length; i++)
- jsonArray.addElement(new StringValue((String)Array.get(array, =
i)));
- }
- else if (t =3D=3D Types.ARRAY_OBJECT)
- {
- for (int i =3D 0; i < length; i++)
- {
- Object el =3D Array.get(array, i);
- // If :
- // 1. Known types (primitive, String, array of primitive or St=
ring)
- // 2. Array of any object (expect for Java Bean)
- // 3. Collection>
- // 4. Map
- if (JsonUtils.getType(el) !=3D null)
- jsonArray.addElement(createJsonValue(el));
- else
- jsonArray.addElement(createJsonObject(el));
- }
- }
else
{
throw new JsonException("Invalid argument, must be array.");
}
- return jsonArray;
}
=
/**
@@ -181,52 +108,35 @@
* @return JSON representation of map
* @throws JsonException if map can't be transformed in JSON representa=
tion
*/
- public JsonValue createJsonObject(Map map) throws JsonE=
xception
+ public JsonValue createJsonObjectFromMap(Map map) throws Jso=
nException
{
- if (map =3D=3D null)
- return new NullValue();
-
- JsonValue jsonObject =3D new ObjectValue();
- Set keys =3D map.keySet();
- for (String k : keys)
- {
- Object o =3D map.get(k);
- // If :
- // 1. Known types (primitive, String, array of primitive or Strin=
g)
- // 2. Array of any object (expect for Java Bean)
- // 3. Collection>
- // 4. Map
- if (JsonUtils.getType(o) !=3D null)
- jsonObject.addElement(k, createJsonValue(o));
- else
- jsonObject.addElement(k, createJsonObject(o));
- }
- return jsonObject;
+ return createJsonValue(map);
}
=
/**
- * {@inheritDoc}
+ * Create JSON object from specified object. Object must be conform wit=
h java
+ * bean structure.
+ *
+ * @param object source object
+ * @return JSON representation of object
+ * @throws JsonException if map can't be transformed in JSON representa=
tion
*/
public JsonValue createJsonObject(Object object) throws JsonException
{
- Method[] methods =3D object.getClass().getMethods();
-
- List transientFields =3D getTransientFields(object.getClass(=
));
-
+ Class> clazz =3D object.getClass();
+ Method[] methods =3D clazz.getMethods();
+ Set transientFields =3D getTransientFields(clazz);
JsonValue jsonRootValue =3D new ObjectValue();
-
for (Method method : methods)
{
String methodName =3D method.getName();
-
/*
* Method must be as follow:
- * 1. Name starts from "get" plus at least one character or start=
s from
- * "is" plus at least one more character and return boolean type
- * 2. Must be without parameters
- * 3. Must not be in list of skipped methods
+ * 1. Name starts from "get" plus at least one character or
+ * starts from "is" plus one more character and return boolean ty=
pe;
+ * 2. Must be without parameters;
+ * 3. Not be in SKIP_METHODS set.
*/
-
String key =3D null;
if (!SKIP_METHODS.contains(methodName) && method.getParameterType=
s().length =3D=3D 0)
{
@@ -240,7 +150,6 @@
key =3D methodName.substring(2);
}
}
-
if (key !=3D null)
{
// First letter of key to lower case.
@@ -252,12 +161,6 @@
{
// Get result of invoke method get...
Object invokeResult =3D method.invoke(object, new Object=
[0]);
-
- // If :
- // 1. Known types (primitive, String, array of primitive=
or String)
- // 2. Array of any object (expect for Java Bean)
- // 3. Collection>
- // 4. Map
if (JsonUtils.getType(invokeResult) !=3D null)
{
jsonRootValue.addElement(key, createJsonValue(invokeR=
esult));
@@ -266,15 +169,14 @@
{
jsonRootValue.addElement(key, createJsonObject(invoke=
Result));
}
-
}
catch (InvocationTargetException e)
{
- throw new JsonException(e);
+ throw new JsonException(e.getMessage(), e);
}
catch (IllegalAccessException e)
{
- throw new JsonException(e);
+ throw new JsonException(e.getMessage(), e);
}
}
}
@@ -292,8 +194,8 @@
@SuppressWarnings("unchecked")
private JsonValue createJsonValue(Object object) throws JsonException
{
- Types t =3D JsonUtils.getType(object);
- switch (t)
+ Types type =3D JsonUtils.getType(object);
+ switch (type)
{
case NULL :
return new NullValue();
@@ -413,7 +315,6 @@
jsonArray.addElement(createJsonObject(el));
}
}
-
return jsonArray;
}
case COLLECTION : {
@@ -430,7 +331,6 @@
jsonArray.addElement(createJsonObject(o));
}
}
-
return jsonArray;
}
case MAP :
@@ -449,13 +349,11 @@
jsonObject.addElement(k, createJsonObject(o));
}
}
-
return jsonObject;
default :
// Must not be here!
return null;
}
-
}
=
/**
@@ -463,18 +361,20 @@
* be not serialized in JSON representation.
*
* @param clazz the class.
- * @return list of fields which must be skiped.
+ * @return set of fields which must be skiped.
*/
- private List getTransientFields(Class> clazz)
+ private static Set getTransientFields(Class> clazz)
{
- List l =3D new ArrayList();
+ Set set =3D new HashSet();
Field[] fields =3D clazz.getDeclaredFields();
for (Field f : fields)
{
if (Modifier.isTransient(f.getModifiers()))
- l.add(f.getName());
+ {
+ set.add(f.getName());
+ }
}
- return l;
+ return set;
}
=
}
Modified: ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/=
frameworks/json/impl/JsonParserImpl.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/framew=
orks/json/impl/JsonParserImpl.java 2010-10-05 11:33:24 UTC (rev 3245)
+++ ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/framew=
orks/json/impl/JsonParserImpl.java 2010-10-05 14:59:07 UTC (rev 3246)
@@ -28,7 +28,6 @@
import java.io.InputStreamReader;
import java.io.PushbackReader;
import java.io.Reader;
-import java.util.Stack;
=
/**
* @author Andrey Parfonov
@@ -37,74 +36,71 @@
public class JsonParserImpl implements JsonParser
{
=
- /**
- * JsonHandler will serve events from parser.
- */
- private JsonHandler jsonHandler;
+ /** JsonHandler will serve events from parser. */
+ private JsonHandler eventHandler;
=
- /**
- * @see {@link java.io.PushbackReader} .
- */
+ /** Stack of JSON tokens. */
+ private final JsonStack stack;
+
+ /** @see {@link java.io.PushbackReader}. */
private PushbackReader pushbackReader;
=
- /**
- * Stack of JSON tokens.
- */
- private Stack jsonTokens =3D new Stack();
-
- /**
- * Default constructor.
- */
public JsonParserImpl()
{
+ stack =3D new JsonStack();
}
=
/**
* {@inheritDoc}
*/
- public void parse(Reader reader, JsonHandler handler) throws JsonExcept=
ion
+ public void parse(Reader reader, JsonHandler eventHandler) throws JsonE=
xception
{
- jsonHandler =3D handler;
- pushbackReader =3D new PushbackReader(reader);
- try
+ this.pushbackReader =3D new PushbackReader(reader);
+ this.eventHandler =3D eventHandler;
+ this.stack.clear();
+
+ char c =3D 0;
+ while ((c =3D next()) !=3D 0)
{
- char c =3D 0;
- while ((c =3D next()) !=3D 0)
+ if (c =3D=3D '{')
{
- if (c =3D=3D '{')
- readObject();
- else
- throw new JsonException("Syntax error. Unexpected '" + c + =
"'. Must be '{'.");
+ readObject();
}
- if (!jsonTokens.isEmpty())
- throw new JsonException("Syntax error. Missing one or more clo=
se bracket(s).");
+ else if (c =3D=3D '[')
+ {
+ readArray();
+ }
+ else
+ {
+ throw new JsonException("Syntax error. Unexpected '" + c + "'.=
Must be '{'.");
+ }
}
- catch (Exception e)
+ if (!stack.isEmpty())
{
- throw new JsonException(e);
+ throw new JsonException("Syntax error. Missing one or more close =
bracket(s).");
}
}
=
/**
* {@inheritDoc}
*/
- public void parse(InputStream sream, JsonHandler handler) throws JsonEx=
ception
+ public void parse(InputStream sream, JsonHandler eventHandler) throws J=
sonException
{
- parse(new InputStreamReader(sream, JsonUtils.DEFAULT_CHARSET), handl=
er);
+ parse(new InputStreamReader(sream, JsonUtils.DEFAULT_CHARSET), event=
Handler);
}
=
/**
* Read JSON object token, it minds all characters from '{' to '}'.
- * =
+ *
* @throws JsonException if JSON document has wrong format or i/o error
- * occurs.
+ * occurs.
*/
private void readObject() throws JsonException
{
char c =3D 0;
// inform handler about start of object
- jsonHandler.startObject();
- jsonTokens.push(JsonToken.object);
+ eventHandler.startObject();
+ stack.push(JsonToken.object);
for (;;)
{
switch (c =3D next())
@@ -116,11 +112,12 @@
break;
case '}' :
// inform handler about end of object
- jsonHandler.endObject();
+ eventHandler.endObject();
// check is allowed end of object now
- if (JsonToken.object !=3D jsonTokens.pop())
+ if (JsonToken.object !=3D stack.pop())
+ {
throw new JsonException("Syntax error. Unexpected end of=
object.");
-
+ }
// check is allowed char after end of json object
switch (c =3D next())
{
@@ -137,11 +134,13 @@
throw new JsonException("Syntax error. Excpected " + =
"for ',' or ']' or '}' but found '" + c
+ "'.");
}
- return; // end for(;;)
+ // end for(;;)
+ return;
case '[' :
readArray();
break;
- case ',' : // nothing to do just must not be default is switch
+ case ',' :
+ // nothing to do just must not be default is switch
break;
default :
back(c);
@@ -152,7 +151,9 @@
back(c);
// object/array/value
if (c !=3D '{' && c !=3D '[')
+ {
readValue();
+ }
break;
}
}
@@ -160,16 +161,16 @@
=
/**
* Read JSON array token, it minds all characters from '[' to ']'.
- * =
+ *
* @throws JsonException if JSON document has wrong format or i/o error
- * occurs.
+ * occurs.
*/
private void readArray() throws JsonException
{
char c =3D 0;
// inform handler about start of array
- jsonHandler.startArray();
- jsonTokens.push(JsonToken.array);
+ eventHandler.startArray();
+ stack.push(JsonToken.array);
for (;;)
{
switch (c =3D next())
@@ -178,22 +179,37 @@
throw new JsonException("Syntax error. Unexpected end of ar=
ray. Array must end by ']'.");
case ']' :
// inform handler about end of array
- jsonHandler.endArray();
+ eventHandler.endArray();
// check is allowed end of array now
- if (JsonToken.array !=3D jsonTokens.pop())
+ if (JsonToken.array !=3D stack.pop())
+ {
throw new JsonException("Syntax error. Unexpected end of=
array.");
+ }
// check is allowed char after end of json array
-
- c =3D next(",]}");
- back(c);
- return; // end for(;;)
+ switch (c =3D next())
+ {
+ // end of stream
+ case 0 :
+ break;
+ case ',' :
+ case ']' :
+ case '}' :
+ back(c);
+ break;
+ default :
+ // must not happen
+ throw new JsonException("Syntax error. Excpected for =
',' or ']' or '}' but found '" + c + "'.");
+ }
+ // end for(;;)
+ return;
case '[' :
readArray();
break;
case '{' :
readObject();
break;
- case ',' : // nothing to do just must not be default
+ case ',' :
+ // nothing to do just must not be default
break;
default :
back(c);
@@ -205,28 +221,32 @@
=
/**
* Read key from stream.
- * =
+ *
* @throws JsonException if JSON document has wrong format or i/o error
- * occurs.
+ * occurs.
*/
private void readKey() throws JsonException
{
char c =3D next();
if (c !=3D '"')
+ {
throw new JsonException("Syntax error. Key must start from quote,=
but found '" + c + "'.");
+ }
back(c);
String s =3D new String(nextString());
// if key as ""
if (s.length() =3D=3D 2)
+ {
throw new JsonException("Missing key.");
- jsonHandler.key(s.substring(1, s.length() - 1));
+ }
+ eventHandler.key(s.substring(1, s.length() - 1));
}
=
/**
* Read value from stream.
- * =
+ *
* @throws JsonException if JSON document has wrong format or i/o error
- * occurs.
+ * occurs.
*/
private void readValue() throws JsonException
{
@@ -235,7 +255,7 @@
if (c =3D=3D '"')
{
// value will be read as string
- jsonHandler.characters(nextString());
+ eventHandler.characters(nextString());
}
else
{
@@ -245,11 +265,13 @@
{
// Bug : WS-66
if (c =3D=3D 0)
+ {
throw new JsonException("Unexpected end of stream.");
+ }
cw.append(c);
}
back(c);
- jsonHandler.characters(cw.toCharArray());
+ eventHandler.characters(cw.toCharArray());
}
c =3D next(",]}");
back(c);
@@ -259,10 +281,10 @@
* Get next char from stream, skipping whitespace and comments. Comment=
s: One
* line comment from // to end of line; Multi-line comments from / and =
* to *
* and /
- * =
+ *
* @return the next char.
* @throws JsonException if JSON document has wrong format or i/o error
- * occurs.
+ * occurs.
*/
private char next() throws JsonException
{
@@ -291,39 +313,41 @@
{
c =3D pushbackReader.read();
if (c =3D=3D '/')
+ {
break;
+ }
}
if (c =3D=3D -1)
{
throw new JsonException("Syntax error. Missing end=
of comment.");
}
}
-
}
else
{
back((char)c);
return '/';
}
-
}
else if (c =3D=3D -1 || c > ' ')
+ {
break;
+ }
}
return (c =3D=3D -1) ? 0 : (char)c;
}
catch (IOException e)
{
- throw new JsonException(e);
+ throw new JsonException(e.getMessage(), e);
}
}
=
/**
* Get next char from stream.
- * =
+ *
* @return the next char.
* @throws JsonException if JSON document has wrong format or i/o error
- * occurs.
+ * occurs.
*/
private char nextAny() throws JsonException
{
@@ -334,48 +358,55 @@
}
catch (IOException e)
{
- throw new JsonException(e);
+ throw new JsonException(e.getMessage(), e);
}
}
=
/**
* Get next char from stream. And check is this char equals expected.
- * =
+ *
* @param c the expected char.
* @return the next char.
* @throws JsonException if JSON document has wrong format or i/o error
- * occurs.
+ * occurs.
*/
private char next(char c) throws JsonException
{
char n =3D next();
if (n !=3D c)
+ {
throw new JsonException("Expected for '" + c + "' but found '" + =
n + "'.");
+ }
return n;
}
=
/**
- * Get next char from stream. And check is this char presents in given =
string.
- * =
+ * Get next char from stream. And check is this char presents in given
+ * string.
+ *
* @param s the string.
* @return the next char.
* @throws JsonException if JSON document has wrong format or i/o error
- * occurs.
+ * occurs.
*/
private char next(String s) throws JsonException
{
char n =3D next();
// if char present in string
if (s.indexOf(n) >=3D 0)
+ {
return n;
+ }
// else error
char[] ch =3D s.toCharArray();
- StringBuffer sb =3D new StringBuffer();
+ StringBuilder sb =3D new StringBuilder();
int i =3D 0;
for (char c : ch)
{
if (i > 0)
+ {
sb.append(" or ");
+ }
i++;
sb.append('\'').append(c).append('\'');
}
@@ -384,11 +415,11 @@
=
/**
* Get next n characters from stream.
- * =
+ *
* @param n the number of characters.
* @return the array of characters.
* @throws JsonException if JSON document has wrong format or i/o error
- * occurs.
+ * occurs.
*/
private char[] next(int n) throws JsonException
{
@@ -397,21 +428,23 @@
{
int i =3D pushbackReader.read(buff);
if (i =3D=3D -1)
+ {
throw new JsonException("Unexpected end of stream.");
+ }
return buff;
}
- catch (Exception e)
+ catch (IOException e)
{
- throw new JsonException(e);
+ throw new JsonException(e.getMessage(), e);
}
}
=
/**
* Get array chars up to given and include it.
- * =
+ *
* @return the char array.
* @throws JsonException if JSON document has wrong format or i/o error
- * occurs.
+ * occurs.
*/
private char[] nextString() throws JsonException
{
@@ -460,7 +493,9 @@
default :
cw.append(c);
if (c =3D=3D '"')
+ {
return cw.toCharArray();
+ }
break;
}
}
@@ -468,10 +503,10 @@
=
/**
* Push back given char to stream.
- * =
+ *
* @param c the char for pushing back.
* @throws JsonException if JSON document has wrong format or i/o error
- * occurs.
+ * occurs.
*/
private void back(char c) throws JsonException
{
@@ -479,9 +514,9 @@
{
pushbackReader.unread(c);
}
- catch (Exception e)
+ catch (IOException e)
{
- throw new JsonException(e);
+ throw new JsonException(e.getMessage(), e);
}
}
=
Added: ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/fra=
meworks/json/impl/JsonStack.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/framew=
orks/json/impl/JsonStack.java (rev 0)
+++ ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/framew=
orks/json/impl/JsonStack.java 2010-10-05 14:59:07 UTC (rev 3246)
@@ -0,0 +1,63 @@
+/**
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.ws.frameworks.json.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Andrey Parfonov
+ * @version $Id$
+ */
+class JsonStack
+{
+
+ private final List elements;
+
+ JsonStack()
+ {
+ elements =3D new ArrayList(16);
+ }
+
+ boolean isEmpty()
+ {
+ return elements.isEmpty();
+ }
+
+ T peek()
+ {
+ return isEmpty() ? null : elements.get(elements.size() - 1);
+ }
+
+ T pop()
+ {
+ return isEmpty() ? null : elements.remove(elements.size() - 1);
+ }
+
+ void push(T token)
+ {
+ elements.add(token);
+ }
+
+ void clear()
+ {
+ elements.clear();
+ }
+}
Property changes on: ws/trunk/exo.ws.frameworks.json/src/main/java/org/exop=
latform/ws/frameworks/json/impl/JsonStack.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/=
frameworks/json/impl/JsonUtils.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/framew=
orks/json/impl/JsonUtils.java 2010-10-05 11:33:24 UTC (rev 3245)
+++ ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/framew=
orks/json/impl/JsonUtils.java 2010-10-05 14:59:07 UTC (rev 3246)
@@ -105,9 +105,7 @@
/** Map. */
MAP,
=
- /**
- * Enum.
- */
+ /** Enum. */
ENUM
}
=
@@ -179,7 +177,7 @@
=
/**
* Transform Java String to JSON string.
- * =
+ *
* @param string source String.
* @return result.
*/
@@ -240,7 +238,7 @@
* String
* Array of T where T satisfies 2 or 3 or 4>
*
- * =
+ *
* @param o Object
* @return true
if Object has one of described above type,
* false
otherwise
@@ -258,7 +256,7 @@
* String
* Array of T where T satisfies 1 or 2 or 3>
*
- * =
+ *
* @param clazz class.
* @return true
if class object represent one of described
* above, false
otherwise
@@ -277,11 +275,12 @@
* Map<String, ?>
*
* then null will be returned
- * =
+ *
* @param o Object.
* @return {@link Types} or null
(see above)
* @see {@link KNOWN_TYPES}.
*/
+ @SuppressWarnings("unchecked")
public static Types getType(Object o)
{
if (o =3D=3D null)
@@ -309,7 +308,7 @@
* Map
*
* then null will be returned
- * =
+ *
* @param o Object.
* @return {@link Types} or null
(see above)
* @see {@link KNOWN_TYPES}.
Modified: ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/=
frameworks/json/impl/JsonWriterImpl.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/framew=
orks/json/impl/JsonWriterImpl.java 2010-10-05 11:33:24 UTC (rev 3245)
+++ ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/framew=
orks/json/impl/JsonWriterImpl.java 2010-10-05 14:59:07 UTC (rev 3246)
@@ -26,7 +26,6 @@
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
-import java.util.Stack;
=
/**
* @author Andrey Parfonov
@@ -35,37 +34,278 @@
public class JsonWriterImpl implements JsonWriter
{
=
- /**
- * Stack for control position in document.
- */
- private final Stack jsonTokens =3D new Stack();
+// /**
+// * Stack for control position in document.
+// */
+// private final Stack jsonTokens =3D new Stack();
+//
+// /**
+// * Writer.
+// */
+// private final Writer writer;
+//
+// /**
+// * Indicate is current value is the first, if not before value must b=
e written
+// * comma.
+// */
+// private boolean commaFirst =3D false;
+//
+// /**
+// * Constructs JsonWriter.
+// *
+// * @param writer Writer.
+// */
+// public JsonWriterImpl(Writer writer)
+// {
+// this.writer =3D writer;
+// }
+//
+// /**
+// * Constructs JsonWriter.
+// *
+// * @param out OutputStream.
+// * @throws UnsupportedEncodingException
+// */
+// public JsonWriterImpl(OutputStream out)
+// {
+// this(new OutputStreamWriter(out, JsonUtils.DEFAULT_CHARSET));
+// }
+//
+// /**
+// * {@inheritDoc}
+// */
+// public void writeStartObject() throws JsonException
+// {
+// if (!jsonTokens.isEmpty())
+// {
+// // Object can be stated after key with followed ':' or as array=
item.
+// if (jsonTokens.peek() !=3D JsonToken.key && jsonTokens.peek() !=
=3D JsonToken.array)
+// throw new JsonException("Syntax error. Unexpected element '{=
'.");
+// }
+// try
+// {
+// if (commaFirst) // needed ',' before
+// writer.write(',');
+// writer.write('{');
+// // if at the top of stack is 'key' then remove it.
+// if (!jsonTokens.isEmpty() && jsonTokens.peek() =3D=3D JsonToken=
.key)
+// jsonTokens.pop();
+// jsonTokens.push(JsonToken.object); // remember new object opened
+// commaFirst =3D false;
+// }
+// catch (IOException e)
+// {
+// throw new JsonException(e);
+// }
+// }
+//
+// /**
+// * {@inheritDoc}
+// */
+// public void writeEndObject() throws JsonException
+// {
+// try
+// {
+// if (jsonTokens.pop() !=3D JsonToken.object) // wrong JSON struc=
ture.
+// throw new JsonException("Sysntax error. Unexpected element '=
}'.");
+// writer.write('}');
+// commaFirst =3D true;
+// }
+// catch (IOException e)
+// {
+// throw new JsonException(e);
+// }
+// }
+//
+// /**
+// * {@inheritDoc}
+// */
+// public void writeStartArray() throws JsonException
+// {
+// if (jsonTokens.isEmpty() || (jsonTokens.peek() !=3D JsonToken.key =
&& jsonTokens.peek() !=3D JsonToken.array))
+// throw new JsonException("Sysntax error. Unexpected element '['.=
.");
+// try
+// {
+// if (commaFirst) // needed ',' before
+// writer.write(',');
+// writer.write('[');
+// if (jsonTokens.peek() =3D=3D JsonToken.key)
+// // if at the top of stack is 'key' then remove it.
+// jsonTokens.pop();
+// jsonTokens.push(JsonToken.array); // remember new array opened
+// commaFirst =3D false;
+// }
+// catch (IOException e)
+// {
+// throw new JsonException(e);
+// }
+// }
+//
+// /**
+// * {@inheritDoc}
+// */
+// public void writeEndArray() throws JsonException
+// {
+// try
+// {
+// if (jsonTokens.pop() !=3D JsonToken.array) // wrong JSON struct=
ure
+// throw new JsonException("Sysntax error. Unexpected element '=
]'.");
+// writer.write(']');
+// commaFirst =3D true;
+// }
+// catch (IOException e)
+// {
+// throw new JsonException(e);
+// }
+// }
+//
+// /**
+// * {@inheritDoc}
+// */
+// public void writeKey(String key) throws JsonException
+// {
+// if (key =3D=3D null)
+// throw new JsonException("Key is null.");
+// if (jsonTokens.isEmpty() || jsonTokens.peek() !=3D JsonToken.objec=
t)
+// throw new JsonException("Sysntax error. Unexpected characters '=
" + key + "'." + jsonTokens);
+// try
+// {
+// if (commaFirst)
+// writer.write(',');
+// // create JSON representation for given string.
+// writer.write(JsonUtils.getJsonString(key));
+// writer.write(':');
+// commaFirst =3D false;
+// jsonTokens.push(JsonToken.key);
+// }
+// catch (IOException e)
+// {
+// throw new JsonException(e);
+// }
+// }
+//
+// /**
+// * {@inheritDoc}
+// */
+// public void writeString(String value) throws JsonException
+// {
+// write(JsonUtils.getJsonString(value));
+// }
+//
+// /**
+// * {@inheritDoc}
+// */
+// public void writeValue(long value) throws JsonException
+// {
+// write(Long.toString(value));
+// }
+//
+// /**
+// * {@inheritDoc}
+// */
+// public void writeValue(double value) throws JsonException
+// {
+// write(Double.toString(value));
+// }
+//
+// /**
+// * {@inheritDoc}
+// */
+// public void writeValue(boolean value) throws JsonException
+// {
+// write(Boolean.toString(value));
+// }
+//
+// /**
+// * {@inheritDoc}
+// */
+// public void writeNull() throws JsonException
+// {
+// write("null");
+// }
+//
+// /**
+// * {@inheritDoc}
+// */
+// public void flush() throws JsonException
+// {
+// try
+// {
+// writer.flush();
+// }
+// catch (IOException e)
+// {
+// new JsonException(e);
+// }
+// }
+//
+// /**
+// * {@inheritDoc}
+// */
+// public void close() throws JsonException
+// {
+// try
+// {
+// writer.close();
+// }
+// catch (IOException e)
+// {
+// new JsonException(e);
+// }
+// }
+//
+// /**
+// * Write single String.
+// *
+// * @param value String.
+// * @throws JsonException if any errors occurs.
+// */
+// private void write(String value) throws JsonException
+// {
+// try
+// {
+// if (jsonTokens.isEmpty() || (jsonTokens.peek() !=3D JsonToken.k=
ey && jsonTokens.peek() !=3D JsonToken.array))
+// throw new JsonException("Sysntax error. Unexpected character=
s '" + value + "'.");
+// if (commaFirst)
+// writer.write(',');
+// writer.write(value);
+// commaFirst =3D true;
+// if (jsonTokens.peek() =3D=3D JsonToken.key)
+// jsonTokens.pop();
+// }
+// catch (IOException e)
+// {
+// throw new JsonException(e);
+// }
+// }
=
- /**
- * Writer.
- */
+
+ /** Stack for control position in document. */
+ private final JsonStack stack;
+
+ /** Writer. */
private final Writer writer;
=
- /**
- * Indicate is current value is the first, if not before value must be =
written
- * comma.
- */
- private boolean commaFirst =3D false;
+ /** Indicate is comma must be written before next object or value. */
+ private boolean commaFirst;
=
/**
* Constructs JsonWriter.
- * =
+ *
* @param writer Writer.
*/
public JsonWriterImpl(Writer writer)
{
this.writer =3D writer;
+ this.stack =3D new JsonStack();
+ this.commaFirst =3D false;
}
=
/**
* Constructs JsonWriter.
- * =
+ *
* @param out OutputStream.
- * @throws UnsupportedEncodingException =
+ * @throws UnsupportedEncodingException
*/
public JsonWriterImpl(OutputStream out)
{
@@ -77,26 +317,32 @@
*/
public void writeStartObject() throws JsonException
{
- if (!jsonTokens.isEmpty())
+ JsonToken token =3D stack.peek();
+ // Object can be stated after key with followed ':' or as array item.
+ if (token !=3D null && token !=3D JsonToken.key && token !=3D JsonTo=
ken.array)
{
- // Object can be stated after key with followed ':' or as array i=
tem.
- if (jsonTokens.peek() !=3D JsonToken.key && jsonTokens.peek() !=
=3D JsonToken.array)
- throw new JsonException("Syntax error. Unexpected element '{'.=
");
+ throw new JsonException("Syntax error. Unexpected element '{'.");
}
try
{
- if (commaFirst) // needed ',' before
+ if (commaFirst)
+ {
+ // needed ',' before
writer.write(',');
+ }
writer.write('{');
// if at the top of stack is 'key' then remove it.
- if (!jsonTokens.isEmpty() && jsonTokens.peek() =3D=3D JsonToken.k=
ey)
- jsonTokens.pop();
- jsonTokens.push(JsonToken.object); // remember new object opened
+ if (token =3D=3D JsonToken.key)
+ {
+ stack.pop();
+ }
+ // remember new object opened
+ stack.push(JsonToken.object);
commaFirst =3D false;
}
catch (IOException e)
{
- throw new JsonException(e);
+ throw new JsonException(e.getMessage(), e);
}
}
=
@@ -107,14 +353,19 @@
{
try
{
- if (jsonTokens.pop() !=3D JsonToken.object) // wrong JSON structu=
re.
+ JsonToken token =3D stack.pop();
+ if (token !=3D JsonToken.object)
+ {
+ System.out.println(token);
+ // wrong JSON structure.
throw new JsonException("Sysntax error. Unexpected element '}'=
.");
+ }
writer.write('}');
commaFirst =3D true;
}
catch (IOException e)
{
- throw new JsonException(e);
+ throw new JsonException(e.getMessage(), e);
}
}
=
@@ -123,22 +374,32 @@
*/
public void writeStartArray() throws JsonException
{
- if (jsonTokens.isEmpty() || (jsonTokens.peek() !=3D JsonToken.key &&=
jsonTokens.peek() !=3D JsonToken.array))
- throw new JsonException("Sysntax error. Unexpected element '['.."=
);
+ JsonToken token =3D stack.peek();
+ //if (token !=3D JsonToken.key && token !=3D JsonToken.array)
+ if (token !=3D null && token !=3D JsonToken.key && token !=3D JsonTo=
ken.array)
+ {
+ throw new JsonException("Sysntax error. Unexpected element '['.");
+ }
try
{
- if (commaFirst) // needed ',' before
+ if (commaFirst)
+ {
+ // needed ',' before
writer.write(',');
+ }
writer.write('[');
- if (jsonTokens.peek() =3D=3D JsonToken.key)
+ if (token =3D=3D JsonToken.key)
+ {
// if at the top of stack is 'key' then remove it.
- jsonTokens.pop();
- jsonTokens.push(JsonToken.array); // remember new array opened
+ stack.pop();
+ }
+ // remember new array opened
+ stack.push(JsonToken.array);
commaFirst =3D false;
}
catch (IOException e)
{
- throw new JsonException(e);
+ throw new JsonException(e.getMessage(), e);
}
}
=
@@ -147,16 +408,20 @@
*/
public void writeEndArray() throws JsonException
{
+ JsonToken token =3D stack.pop();
try
{
- if (jsonTokens.pop() !=3D JsonToken.array) // wrong JSON structure
+ if (token !=3D JsonToken.array)
+ {
+ // wrong JSON structure
throw new JsonException("Sysntax error. Unexpected element ']'=
.");
+ }
writer.write(']');
commaFirst =3D true;
}
catch (IOException e)
{
- throw new JsonException(e);
+ throw new JsonException(e.getMessage(), e);
}
}
=
@@ -166,22 +431,30 @@
public void writeKey(String key) throws JsonException
{
if (key =3D=3D null)
+ {
throw new JsonException("Key is null.");
- if (jsonTokens.isEmpty() || jsonTokens.peek() !=3D JsonToken.object)
- throw new JsonException("Sysntax error. Unexpected characters '" =
+ key + "'." + jsonTokens);
+ }
+
+ JsonToken token =3D stack.peek();
+ if (token !=3D JsonToken.object)
+ {
+ throw new JsonException("Sysntax error. Unexpected characters '" =
+ key + "'.");
+ }
try
{
if (commaFirst)
+ {
writer.write(',');
+ }
// create JSON representation for given string.
writer.write(JsonUtils.getJsonString(key));
writer.write(':');
commaFirst =3D false;
- jsonTokens.push(JsonToken.key);
+ stack.push(JsonToken.key);
}
catch (IOException e)
{
- throw new JsonException(e);
+ throw new JsonException(e.getMessage(), e);
}
}
=
@@ -226,57 +499,66 @@
}
=
/**
- * {@inheritDoc}
+ * Write single String.
+ *
+ * @param value String.
+ * @throws JsonException if any errors occurs.
*/
- public void flush() throws JsonException
+ private void write(String value) throws JsonException
{
+ JsonToken token =3D stack.peek();
try
{
- writer.flush();
+ if (token !=3D JsonToken.key && token !=3D JsonToken.array)
+ {
+ throw new JsonException("Sysntax error. Unexpected characters =
'" + value + "'.");
+ }
+ if (commaFirst)
+ {
+ writer.write(',');
+ }
+ writer.write(value);
+ commaFirst =3D true;
+ if (token =3D=3D JsonToken.key)
+ {
+ // if at the top of stack is 'key' then remove it.
+ stack.pop();
+ }
}
catch (IOException e)
{
- new JsonException(e);
+ throw new JsonException(e.getMessage(), e);
}
}
=
/**
* {@inheritDoc}
*/
- public void close() throws JsonException
+ public void flush() throws JsonException
{
try
{
- writer.close();
+ writer.flush();
}
catch (IOException e)
{
- new JsonException(e);
+ new JsonException(e.getMessage(), e);
}
}
=
/**
- * Write single String.
- * =
- * @param value String.
- * @throws JsonException if any errors occurs.
+ * {@inheritDoc}
*/
- private void write(String value) throws JsonException
+ public void close() throws JsonException
{
try
{
- if (jsonTokens.isEmpty() || (jsonTokens.peek() !=3D JsonToken.key=
&& jsonTokens.peek() !=3D JsonToken.array))
- throw new JsonException("Sysntax error. Unexpected characters =
'" + value + "'.");
- if (commaFirst)
- writer.write(',');
- writer.write(value);
- commaFirst =3D true;
- if (jsonTokens.peek() =3D=3D JsonToken.key)
- jsonTokens.pop();
+ writer.close();
}
catch (IOException e)
{
- throw new JsonException(e);
+ new JsonException(e.getMessage(), e);
}
}
+
}
Added: ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/fra=
meworks/json/impl/ObjectBuilder.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/framew=
orks/json/impl/ObjectBuilder.java (rev 0)
+++ ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/framew=
orks/json/impl/ObjectBuilder.java 2010-10-05 14:59:07 UTC (rev 3246)
@@ -0,0 +1,586 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.ws.frameworks.json.impl;
+
+import org.exoplatform.ws.frameworks.json.impl.JsonUtils.Types;
+import org.exoplatform.ws.frameworks.json.value.JsonValue;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.Map;
+
+/**
+ * @author Andrey Parfonov
+ * @version $Id$
+ */
+public class ObjectBuilder
+{
+ static final Collection SKIP_METHODS =3D new HashSet();
+ static
+ {
+ // Since we need support for Groovy must skip this.
+ // All "Groovy Objects" implements interface groovy.lang.GroovyObject
+ // and has method setMetaClass. Not need to process it.
+ SKIP_METHODS.add("setMetaClass");
+ }
+
+ /**
+ * Create array of Java Object from JSON source include multi-dimension
+ * array.
+ *
+ * @param clazz the Class of target Object.
+ * @param jsonArray the JSON representation of array
+ * @return result array
+ * @throws JsonException if any errors occurs
+ */
+ public static Object createArray(Class> clazz, JsonValue jsonArray) t=
hrows JsonException
+ {
+ Object array =3D null;
+ if (jsonArray !=3D null && !jsonArray.isNull())
+ {
+ Class> componentType =3D clazz.getComponentType();
+ array =3D Array.newInstance(componentType, jsonArray.size());
+ Iterator values =3D jsonArray.getElements();
+ int i =3D 0;
+
+ if (componentType.isArray())
+ {
+ if (JsonUtils.isKnownType(componentType))
+ {
+ while (values.hasNext())
+ {
+ JsonValue v =3D values.next();
+ Array.set(array, i++, createObjectKnownTypes(componentTy=
pe, v));
+ }
+ }
+ else
+ {
+ while (values.hasNext())
+ {
+ JsonValue v =3D values.next();
+ Array.set(array, i++, createArray(componentType, v));
+ }
+ }
+ }
+ else
+ {
+ if (JsonUtils.isKnownType(componentType))
+ {
+ while (values.hasNext())
+ {
+ JsonValue v =3D values.next();
+ Array.set(array, i++, createObjectKnownTypes(componentTy=
pe, v));
+ }
+ }
+ else
+ {
+ while (values.hasNext())
+ {
+ JsonValue v =3D values.next();
+ Array.set(array, i++, createObject(componentType, v));
+ }
+ }
+ }
+ }
+ return array;
+ }
+
+ /**
+ * Create instance of collectionClass
from JSON representa=
tion.
+ * If collectionClass
is interface then appropriate
+ * implementation of interface will be returned.
+ *
+ * @param collectionClass collection type
+ * @param genericType generic type of collection
+ * @param jsonArray the JSON representation of collection
+ * @return result collection
+ * @throws JsonException if any errors occurs
+ */
+ public static > T createCollection(Class col=
lectionClass, Type genericType,
+ JsonValue jsonArray) throws JsonException
+ {
+ T collection =3D null;
+ if (jsonArray !=3D null && !jsonArray.isNull())
+ {
+ Class> actualType =3D null;
+ if (genericType instanceof ParameterizedType)
+ {
+ // Collection can't be parameterized by other Collection, Arra=
y, etc.
+ ParameterizedType parameterizedType =3D (ParameterizedType)gen=
ericType;
+ try
+ {
+ actualType =3D (Class>)parameterizedType.getActualTypeArg=
uments()[0];
+ }
+ catch (ClassCastException e)
+ {
+ throw new JsonException("This type of Collection can't be r=
estored from JSON source. "
+ + "\nCollection is parameterized by wrong Type: " + para=
meterizedType + ".");
+ }
+ }
+ else
+ {
+ throw new JsonException("Collection is not parameterized. Coll=
ection> is not supported. "
+ + "\nCollection must be parameterized by any types, or by J=
avaBean with 'get' and 'set' methods.");
+ }
+
+ Constructor extends T> constructor =3D null;
+ if (collectionClass.isInterface() || Modifier.isAbstract(collecti=
onClass.getModifiers()))
+ {
+ try
+ {
+ constructor =3D ArrayList.class.asSubclass(collectionClass)=
.getConstructor(new Class[]{Collection.class});
+ }
+ catch (Exception e)
+ {
+ try
+ {
+ constructor =3D HashSet.class.asSubclass(collectionClass=
).getConstructor(new Class[]{Collection.class});
+ }
+ catch (Exception e1)
+ {
+ try
+ {
+ constructor =3D
+ LinkedList.class.asSubclass(collectionClass).getCo=
nstructor(new Class[]{Collection.class});
+ }
+ catch (Exception e2)
+ {
+ // ignore exception here
+ }
+ }
+ }
+ }
+ else
+ {
+ try
+ {
+ constructor =3D collectionClass.getConstructor(new Class[]{=
Collection.class});
+ }
+ catch (Exception e)
+ {
+ throw new JsonException(e.getMessage(), e);
+ }
+ }
+
+ if (constructor =3D=3D null)
+ {
+ throw new JsonException("Can't find satisfied constructor for =
: " + collectionClass);
+ }
+
+ ArrayList sourceCollection =3D new ArrayList(json=
Array.size());
+ Iterator values =3D jsonArray.getElements();
+ while (values.hasNext())
+ {
+ JsonValue v =3D values.next();
+ if (!JsonUtils.isKnownType(actualType))
+ {
+ sourceCollection.add(createObject(actualType, v));
+ }
+ else
+ {
+ sourceCollection.add(createObjectKnownTypes(actualType, v));
+ }
+ }
+ try
+ {
+ collection =3D constructor.newInstance(sourceCollection);
+ }
+ catch (Exception e)
+ {
+ throw new JsonException(e.getMessage(), e);
+ }
+ }
+ return collection;
+ }
+
+ /**
+ * Create instance of mapClass
from JSON representation. If
+ * mapClass
is interface then appropriate implementation of
+ * interface will be returned.
+ *
+ * @param mapClass map type
+ * @param genericType actual type of map
+ * @param jsonObject source JSON object
+ * @return map
+ * @throws JsonException if any errors occurs
+ */
+ public static > T createObject(Class mapCla=
ss, Type genericType, JsonValue jsonObject)
+ throws JsonException
+ {
+ T map =3D null;
+ if (jsonObject !=3D null && !jsonObject.isNull())
+ {
+ Class> valueActualType =3D null;
+ if (genericType instanceof ParameterizedType)
+ {
+ ParameterizedType parameterizedType =3D (ParameterizedType)gen=
ericType;
+ if (!String.class.isAssignableFrom((Class>)parameterizedType=
.getActualTypeArguments()[0]))
+ {
+ throw new JsonException("Key of Map must be String. ");
+ }
+ try
+ {
+ valueActualType =3D (Class>)parameterizedType.getActualTy=
peArguments()[1];
+ }
+ catch (ClassCastException e)
+ {
+ throw new JsonException("This type of Map can't be restored=
from JSON source."
+ + "\nMap is parameterized by wrong Type: " + parameteriz=
edType + ".");
+ }
+ }
+ else
+ {
+ throw new JsonException("Map is not parameterized. Map is not supported."
+ + "\nMap must be parameterized by String and any types or J=
avaBean with 'get' and 'set' methods.");
+ }
+ Constructor extends T> constructor =3D null;
+ if (mapClass.isInterface() || Modifier.isAbstract(mapClass.getMod=
ifiers()))
+ {
+ try
+ {
+ constructor =3D HashMap.class.asSubclass(mapClass).getConst=
ructor(new Class[]{Map.class});
+ }
+ catch (Exception e)
+ {
+ try
+ {
+ constructor =3D Hashtable.class.asSubclass(mapClass).get=
Constructor(new Class[]{Map.class});
+ }
+ catch (Exception e1)
+ {
+ try
+ {
+ constructor =3D LinkedHashMap.class.asSubclass(mapCla=
ss).getConstructor(new Class[]{Map.class});
+ }
+ catch (Exception e2)
+ {
+ // ignore exception here
+ }
+ }
+ }
+ }
+ else
+ {
+ try
+ {
+ constructor =3D mapClass.getConstructor(new Class[]{Map.cla=
ss});
+ }
+ catch (Exception e)
+ {
+ throw new JsonException(e.getMessage(), e);
+ }
+ }
+
+ if (constructor =3D=3D null)
+ {
+ throw new JsonException("Can't find satisfied constructor for =
: " + mapClass);
+ }
+
+ HashMap sourceMap =3D new HashMap=
(jsonObject.size());
+ Iterator keys =3D jsonObject.getKeys();
+ while (keys.hasNext())
+ {
+ String k =3D keys.next();
+ JsonValue v =3D jsonObject.getElement(k);
+ if (!JsonUtils.isKnownType(valueActualType))
+ {
+ sourceMap.put(k, createObject(valueActualType, v));
+ }
+ else
+ {
+ sourceMap.put(k, createObjectKnownTypes(valueActualType, v)=
);
+ }
+ }
+ try
+ {
+ map =3D constructor.newInstance(sourceMap);
+ }
+ catch (Exception e)
+ {
+ throw new JsonException(e.getMessage(), e);
+ }
+ }
+ return map;
+ }
+
+ /**
+ * Create Java Bean from Json Source.
+ *
+ * @param clazz the Class of target Object.
+ * @param jsonValue the Json representation.
+ * @return Object.
+ * @throws JsonException if any errors occurs.
+ */
+ @SuppressWarnings("unchecked")
+ public static T createObject(Class clazz, JsonValue jsonValue) t=
hrows JsonException
+ {
+ if (jsonValue =3D=3D null || jsonValue.isNull())
+ {
+ return null;
+ }
+
+ Types type =3D JsonUtils.getType(clazz);
+ if (type =3D=3D Types.ENUM)
+ {
+ // Enum is not instantiable via CLass.getInstance().
+ // This is used when enum is member of array or collection.
+ Class c =3D clazz;
+ return (T)Enum.valueOf(c, jsonValue.getStringValue());
+ }
+
+ if (!jsonValue.isObject())
+ {
+ throw new JsonException("Unsupported type of jsonValue. ");
+ }
+
+ T object =3D null;
+ try
+ {
+ object =3D clazz.newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new JsonException("Unable instantiate object. " + e.getMess=
age(), e);
+ }
+
+ Method[] methods =3D clazz.getMethods();
+
+ for (Method method : methods)
+ {
+ String methodName =3D method.getName();
+ Class>[] parameterTypes =3D method.getParameterTypes();
+ // 3 is length of prefix 'set'
+ if (!SKIP_METHODS.contains(methodName) && methodName.startsWith("=
set") && parameterTypes.length =3D=3D 1
+ && methodName.length() > 3)
+ {
+ Class> methodParameterClass =3D parameterTypes[0];
+ // 3 is length of prefix 'set'
+ String key =3D methodName.substring(3);
+ // first letter to lower case
+ key =3D (key.length() > 1) ? Character.toLowerCase(key.charAt(=
0)) + key.substring(1) : key.toLowerCase();
+
+ JsonValue childJsonValue =3D jsonValue.getElement(key);
+ if (childJsonValue =3D=3D null)
+ {
+ continue;
+ }
+ // if one of known primitive type or array of primitive type
+ try
+ {
+
+ if (JsonUtils.isKnownType(methodParameterClass))
+ {
+ method.invoke(object, new Object[]{createObjectKnownType=
s(methodParameterClass, childJsonValue)});
+ }
+ else
+ {
+ Types parameterType =3D JsonUtils.getType(methodParamete=
rClass);
+ // other type Collection, Map or Object[].
+ if (parameterType !=3D null)
+ {
+ if (parameterType =3D=3D Types.ENUM)
+ {
+ Class c =3D methodParameterClass;
+ Enum> en =3D Enum.valueOf(c, childJsonValue.getS=
tringValue());
+ method.invoke(object, new Object[]{en});
+ }
+ else if (parameterType =3D=3D Types.ARRAY_OBJECT)
+ {
+ Object array =3D createArray(methodParameterClass,=
childJsonValue);
+ method.invoke(object, new Object[]{array});
+ }
+ else if (parameterType =3D=3D Types.COLLECTION)
+ {
+ Class c =3D methodParameterClass;
+ method
+ .invoke(object, createCollection(c, method.getG=
enericParameterTypes()[0], childJsonValue));
+ }
+ else if (parameterType =3D=3D Types.MAP)
+ {
+ Class c =3D methodParameterClass;
+ method.invoke(object, createObject(c, method.getGe=
nericParameterTypes()[0], childJsonValue));
+ }
+ else
+ {
+ // it must never happen!
+ throw new JsonException("Can't restore parameter o=
f method : " + clazz.getName() + "#"
+ + method.getName() + " from JSON source.");
+ }
+ }
+ else
+ {
+ method.invoke(object, createObject(methodParameterCla=
ss, childJsonValue));
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ throw new JsonException("Unable restore parameter via metho=
d " + clazz.getName() + "#"
+ + method.getName() + ". " + e.getMessage(), e);
+ }
+ }
+ }
+ return object;
+ }
+
+ /**
+ * Create Objects of known types.
+ *
+ * @param clazz class.
+ * @param jsonValue JsonValue , @see {@link JsonValue}
+ * @return Object.
+ * @throws JsonException if type is unknown.
+ */
+ private static Object createObjectKnownTypes(Class> clazz, JsonValue =
jsonValue) throws JsonException
+ {
+ Types t =3D JsonUtils.getType(clazz);
+ switch (t)
+ {
+ case NULL :
+ return null;
+ case BOOLEAN :
+ return jsonValue.getBooleanValue();
+ case BYTE :
+ return jsonValue.getByteValue();
+ case SHORT :
+ return jsonValue.getShortValue();
+ case INT :
+ return jsonValue.getIntValue();
+ case LONG :
+ return jsonValue.getLongValue();
+ case FLOAT :
+ return jsonValue.getFloatValue();
+ case DOUBLE :
+ return jsonValue.getDoubleValue();
+ case CHAR :
+ // TODO check String length
+ return jsonValue.getStringValue().charAt(0);
+ case STRING :
+ return jsonValue.getStringValue();
+ case ARRAY_BOOLEAN : {
+ boolean[] params =3D new boolean[jsonValue.size()];
+ Iterator values =3D jsonValue.getElements();
+ int i =3D 0;
+ while (values.hasNext())
+ {
+ params[i++] =3D values.next().getBooleanValue();
+ }
+ return params;
+ }
+ case ARRAY_BYTE : {
+ byte[] params =3D new byte[jsonValue.size()];
+ Iterator values =3D jsonValue.getElements();
+ int i =3D 0;
+ while (values.hasNext())
+ {
+ params[i++] =3D values.next().getByteValue();
+ }
+ return params;
+ }
+ case ARRAY_SHORT : {
+ short[] params =3D new short[jsonValue.size()];
+ Iterator values =3D jsonValue.getElements();
+ int i =3D 0;
+ while (values.hasNext())
+ {
+ params[i++] =3D values.next().getShortValue();
+ }
+ return params;
+ }
+ case ARRAY_INT : {
+ int[] params =3D new int[jsonValue.size()];
+ Iterator values =3D jsonValue.getElements();
+ int i =3D 0;
+ while (values.hasNext())
+ {
+ params[i++] =3D values.next().getIntValue();
+ }
+ return params;
+ }
+ case ARRAY_LONG : {
+ long[] params =3D new long[jsonValue.size()];
+ Iterator values =3D jsonValue.getElements();
+ int i =3D 0;
+ while (values.hasNext())
+ {
+ params[i++] =3D values.next().getLongValue();
+ }
+ return params;
+ }
+ case ARRAY_FLOAT : {
+ float[] params =3D new float[jsonValue.size()];
+ Iterator values =3D jsonValue.getElements();
+ int i =3D 0;
+ while (values.hasNext())
+ {
+ params[i++] =3D values.next().getFloatValue();
+ }
+ return params;
+ }
+ case ARRAY_DOUBLE : {
+ double[] params =3D new double[jsonValue.size()];
+ Iterator values =3D jsonValue.getElements();
+ int i =3D 0;
+ while (values.hasNext())
+ {
+ params[i++] =3D values.next().getDoubleValue();
+ }
+ return params;
+ }
+ case ARRAY_CHAR : {
+ char[] params =3D new char[jsonValue.size()];
+ Iterator values =3D jsonValue.getElements();
+ int i =3D 0;
+ // TODO better checking an transformation string to char
+ while (values.hasNext())
+ {
+ params[i++] =3D values.next().getStringValue().charAt(0);
+ }
+ return params;
+ }
+ case ARRAY_STRING : {
+ String[] params =3D new String[jsonValue.size()];
+ Iterator values =3D jsonValue.getElements();
+ int i =3D 0;
+ while (values.hasNext())
+ {
+ params[i++] =3D values.next().getStringValue();
+ }
+ return params;
+ }
+ default :
+ // Nothing to do for other type. Exception will be thrown.
+ break;
+ }
+ throw new JsonException("Unknown type " + clazz.getName());
+ }
+
+}
Property changes on: ws/trunk/exo.ws.frameworks.json/src/main/java/org/exop=
latform/ws/frameworks/json/impl/ObjectBuilder.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/=
frameworks/json/Book.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framew=
orks/json/Book.java 2010-10-05 11:33:24 UTC (rev 3245)
+++ ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framew=
orks/json/Book.java 2010-10-05 14:59:07 UTC (rev 3246)
@@ -20,7 +20,7 @@
=
/**
* @author Andrey Parfonov
- * @version $Id: Book.java 34417 2009-07-23 14:42:56Z dkatayev $
+ * @version $Id: Book.java 45 2010-10-05 06:51:11Z andrew00x $
*/
public class Book
{
@@ -135,10 +135,33 @@
return sb.toString();
}
=
- public boolean equals(Book book)
+ public int hashCode()
{
- return book.getAuthor().equals(author) && book.getTitle().equals(tit=
le) && book.getIsdn() =3D=3D isdn
- && book.getPages() =3D=3D pages && book.getPrice() =3D=3D price &=
& book.isAvailability() =3D=3D availability
- && book.getDelivery() =3D=3D delivery;
+ int hash =3D 8;
+ hash =3D hash * 31 + (author !=3D null ? author.hashCode() : 0);
+ hash =3D hash * 31 + (title !=3D null ? title.hashCode() : 0);
+ hash =3D (int)(hash * 31 + isdn);
+ hash =3D hash * 31 + pages;
+ hash =3D (int)(hash * 31 + Double.doubleToLongBits(pages));
+ hash =3D (int)(hash * 31 + Double.doubleToLongBits(pages));
+ hash =3D hash + (availability ? 1 : 0);
+ hash =3D hash + (delivery ? 1 : 0);
+ return hash;
}
+
+ public boolean equals(Object other)
+ {
+ if (other =3D=3D null)
+ return false;
+ if (other.getClass() !=3D getClass())
+ return false;
+ Book book =3D (Book)other;
+ return (author !=3D null && author.equals(book.getAuthor())) //
+ && (title !=3D null && title.equals(book.getTitle())) //
+ && (isdn =3D=3D book.getIsdn()) //
+ && (pages =3D=3D book.getPages()) //
+ && (price =3D=3D book.getPrice()) //
+ && (availability =3D=3D book.isAvailability()) //
+ && (delivery =3D=3D book.getDelivery());
+ }
}
Deleted: ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/f=
rameworks/json/impl/JavaNumericTypeTest.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framew=
orks/json/impl/JavaNumericTypeTest.java 2010-10-05 11:33:24 UTC (rev 3245)
+++ ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framew=
orks/json/impl/JavaNumericTypeTest.java 2010-10-05 14:59:07 UTC (rev 3246)
@@ -1,103 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.ws.frameworks.json.impl;
-
-import junit.framework.TestCase;
-
-import org.exoplatform.ws.frameworks.json.JsonHandler;
-import org.exoplatform.ws.frameworks.json.value.JsonValue;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStreamReader;
-import java.util.Iterator;
-
-/**
- * @author Andrey Parfonov
- * @version $Id: JavaNumericTypeTest.java 34417 2009-07-23 14:42:56Z dkata=
yev $
- */
-public class JavaNumericTypeTest extends TestCase
-{
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- }
-
- public void testLong() throws Exception
- {
- JsonParserImpl jsonParser =3D new JsonParserImpl();
- JsonHandler jsonHandler =3D new JsonDefaultHandler();
- String jsonString =3D
- "{" + "\"long\":[" + "1, 0xAA, 077, 123, 32765, 77787, 123456789,=
" + "0x123456, 0123456, -2387648, -123456789"
- + "]" + "}";
-
- jsonParser.parse(new InputStreamReader(new ByteArrayInputStream(json=
String.getBytes())), jsonHandler);
- JsonValue jv =3D jsonHandler.getJsonObject();
- assertTrue(jv.getElement("long").isArray());
- Iterator values =3D jv.getElement("long").getElements();
- int i =3D 0;
- while (values.hasNext())
- {
- JsonValue v =3D values.next();
- assertTrue(v.isNumeric());
- assertTrue(v.isLong());
- assertFalse(v.isDouble());
- if (i =3D=3D 0)
- assertEquals(1L, v.getLongValue());
- if (i =3D=3D 3)
- assertEquals(123L, v.getLongValue());
- if (i =3D=3D 6)
- assertEquals(123456789L, v.getLongValue());
- i++;
- }
- }
-
- public void testDouble() throws Exception
- {
- JsonParserImpl jsonParser =3D new JsonParserImpl();
- JsonHandler jsonHandler =3D new JsonDefaultHandler();
- String jsonString =3D
- "{" + "\"double\":[" + "1.0, 0.0006382746, 111111.2222222, 999999=
9999999.9999999999999,"
- + "9827394873249.8, 1.23456789E8, 123456.789E8, 32154783524786=
51238.0,"
- + "982.8, 0.00000000000023456789E8, 1.789E8, 0.000000000000000=
0000321547835247865123,"
- + "982.8, -0.00000000000023456789E8, -1.789E-8, -0.00000000000=
00000000321547835247865123" + "]" + "}";
-
- jsonParser.parse(new InputStreamReader(new ByteArrayInputStream(json=
String.getBytes())), jsonHandler);
- JsonValue jv =3D jsonHandler.getJsonObject();
- assertTrue(jv.getElement("double").isArray());
- Iterator values =3D jv.getElement("double").getElements();
- int i =3D 0;
- while (values.hasNext())
- {
- JsonValue v =3D values.next();
- assertTrue(v.isNumeric());
- assertFalse(v.isLong());
- assertTrue(v.isDouble());
- if (i =3D=3D 0)
- assertEquals(1.0, v.getDoubleValue());
- if (i =3D=3D 2)
- assertEquals(111111.2222222, v.getDoubleValue());
- if (i =3D=3D 9)
- assertEquals(0.00000000000023456789E8, v.getDoubleValue());
- i++;
- }
- }
-
-}
Modified: ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/=
frameworks/json/impl/JsonGeneratorTest.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framew=
orks/json/impl/JsonGeneratorTest.java 2010-10-05 11:33:24 UTC (rev 3245)
+++ ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framew=
orks/json/impl/JsonGeneratorTest.java 2010-10-05 14:59:07 UTC (rev 3246)
@@ -18,8 +18,6 @@
*/
package org.exoplatform.ws.frameworks.json.impl;
=
-import junit.framework.TestCase;
-
import org.exoplatform.ws.frameworks.json.BeanWithBookEnum;
import org.exoplatform.ws.frameworks.json.BeanWithSimpleEnum;
import org.exoplatform.ws.frameworks.json.BeanWithTransientField;
@@ -42,7 +40,7 @@
* @author Andrey Parfonov
* @version $Id: JsonGeneratorTest.java 34417 2009-07-23 14:42:56Z dkataye=
v $
*/
-public class JsonGeneratorTest extends TestCase
+public class JsonGeneratorTest extends JsonTest
{
=
@Override
@@ -51,98 +49,103 @@
super.setUp();
}
=
- public void testSimpleObject() throws Exception
+ public void testBean() throws Exception
{
- int _pages =3D 386;
- long _isdn =3D 93011099534534L;
- double _price =3D 19.37;
- String _title =3D "JUnit in Action";
- String _author =3D "Vincent Masson";
- boolean _delivery =3D true;
- boolean _availability =3D true;
- Book book =3D new Book();
- book.setAuthor(_author);
- book.setTitle(_title);
- book.setPages(_pages);
- book.setPrice(_price);
- book.setIsdn(_isdn);
- book.setAvailability(_availability);
- book.setDelivery(_delivery);
+ JsonValue jsonValue =3D new JsonGeneratorImpl().createJsonObject(jun=
itBook);
+ assertTrue(jsonValue.isObject());
+ assertEquals(junitBook.getAuthor(), jsonValue.getElement("author").g=
etStringValue());
+ assertEquals(junitBook.getTitle(), jsonValue.getElement("title").get=
StringValue());
+ assertEquals(junitBook.getPages(), jsonValue.getElement("pages").get=
IntValue());
+ assertEquals(junitBook.getPrice(), jsonValue.getElement("price").get=
DoubleValue());
+ assertEquals(junitBook.getIsdn(), jsonValue.getElement("isdn").getLo=
ngValue());
+ assertEquals(junitBook.getDelivery(), jsonValue.getElement("delivery=
").getBooleanValue());
+ assertEquals(junitBook.isAvailability(), jsonValue.getElement("avail=
ability").getBooleanValue());
+ }
=
- JsonValue jsonValue =3D new JsonGeneratorImpl().createJsonObject(boo=
k);
+ public void testArray() throws Exception
+ {
+ Book[] a =3D new Book[]{junitBook, csharpBook, javaScriptBook};
+ JsonValue jsonValue =3D new JsonGeneratorImpl().createJsonArray(a);
+ assertTrue(jsonValue.isArray());
+ Iterator iterator =3D jsonValue.getElements();
+ assertEquals(a[0].getTitle(), iterator.next().getElement("title").ge=
tStringValue());
+ assertEquals(a[1].getTitle(), iterator.next().getElement("title").ge=
tStringValue());
+ assertEquals(a[2].getTitle(), iterator.next().getElement("title").ge=
tStringValue());
+ //System.out.println(jsonValue);
+ }
+
+ public void testArrayNull() throws Exception
+ {
+ Book[] a =3D null;
+ JsonValue jsonValue =3D new JsonGeneratorImpl().createJsonArray(a);
+ assertTrue(jsonValue.isNull());
+ }
+
+ public void testCollection() throws Exception
+ {
+ List l =3D Arrays.asList(junitBook, csharpBook, javaScriptBook=
);
+ JsonValue jsonValue =3D new JsonGeneratorImpl().createJsonArray(l);
+ assertTrue(jsonValue.isArray());
+ Iterator iterator =3D jsonValue.getElements();
+ assertEquals(l.get(0).getTitle(), iterator.next().getElement("title"=
).getStringValue());
+ assertEquals(l.get(1).getTitle(), iterator.next().getElement("title"=
).getStringValue());
+ assertEquals(l.get(2).getTitle(), iterator.next().getElement("title"=
).getStringValue());
+ //System.out.println(jsonValue);
+ }
+
+ public void testCollectionNull() throws Exception
+ {
+ List l =3D null;
+ JsonValue jsonValue =3D new JsonGeneratorImpl().createJsonArray(l);
+ assertTrue(jsonValue.isNull());
+ }
+
+ public void testMap() throws Exception
+ {
+ Map m =3D new HashMap();
+ m.put("junit", junitBook);
+ m.put("csharp", csharpBook);
+ m.put("js", javaScriptBook);
+ JsonValue jsonValue =3D new JsonGeneratorImpl().createJsonObjectFrom=
Map(m);
assertTrue(jsonValue.isObject());
- assertEquals(_author, jsonValue.getElement("author").getStringValue(=
));
- assertEquals(_title, jsonValue.getElement("title").getStringValue());
- assertEquals(_pages, jsonValue.getElement("pages").getIntValue());
- assertEquals(_price, jsonValue.getElement("price").getDoubleValue());
- assertEquals(_isdn, jsonValue.getElement("isdn").getLongValue());
- assertEquals(_delivery, jsonValue.getElement("delivery").getBooleanV=
alue());
- assertEquals(_availability, jsonValue.getElement("availability").get=
BooleanValue());
+ assertEquals(junitBook.getTitle(), jsonValue.getElement("junit").get=
Element("title").getStringValue());
+ assertEquals(csharpBook.getTitle(), jsonValue.getElement("csharp").g=
etElement("title").getStringValue());
+ assertEquals(javaScriptBook.getTitle(), jsonValue.getElement("js").g=
etElement("title").getStringValue());
+ //System.out.println(jsonValue);
}
=
- public void testSimpleObject2() throws Exception
+ public void testMapNull() throws Exception
{
- int _pages =3D 386;
- int _isdn =3D 930110995;
- double _price =3D 19.37;
- String _title =3D "JUnit in Action";
- String _author =3D "Vincent Masson";
- boolean _delivery =3D false;
- boolean _availability =3D true;
- Book book =3D new Book();
- book.setAuthor(_author);
- book.setTitle(_title);
- book.setPages(_pages);
- book.setPrice(_price);
- book.setIsdn(_isdn);
- book.setAvailability(_availability);
- book.setDelivery(_delivery);
+ Map m =3D null;
+ JsonValue jsonValue =3D new JsonGeneratorImpl().createJsonObjectFrom=
Map(m);
+ assertTrue(jsonValue.isNull());
+ }
=
+ public void testBeanWrapper() throws Exception
+ {
BookWrapper bookWrapper =3D new BookWrapper();
- bookWrapper.setBook(book);
+ bookWrapper.setBook(junitBook);
JsonValue jsonValue =3D new JsonGeneratorImpl().createJsonObject(boo=
kWrapper);
assertTrue(jsonValue.isObject());
- assertEquals(_author, jsonValue.getElement("book").getElement("autho=
r").getStringValue());
- assertEquals(_title, jsonValue.getElement("book").getElement("title"=
).getStringValue());
- assertEquals(_pages, jsonValue.getElement("book").getElement("pages"=
).getIntValue());
- assertEquals(_price, jsonValue.getElement("book").getElement("price"=
).getDoubleValue());
- assertEquals(_isdn, jsonValue.getElement("book").getElement("isdn").=
getLongValue());
- assertEquals(_delivery, jsonValue.getElement("book").getElement("del=
ivery").getBooleanValue());
- assertEquals(_availability, jsonValue.getElement("book").getElement(=
"availability").getBooleanValue());
+ assertEquals(junitBook.getAuthor(), jsonValue.getElement("book").get=
Element("author").getStringValue());
+ assertEquals(junitBook.getTitle(), jsonValue.getElement("book").getE=
lement("title").getStringValue());
+ assertEquals(junitBook.getPages(), jsonValue.getElement("book").getE=
lement("pages").getIntValue());
+ assertEquals(junitBook.getPrice(), jsonValue.getElement("book").getE=
lement("price").getDoubleValue());
+ assertEquals(junitBook.getIsdn(), jsonValue.getElement("book").getEl=
ement("isdn").getLongValue());
+ assertEquals(junitBook.getDelivery(), jsonValue.getElement("book").g=
etElement("delivery").getBooleanValue());
+ assertEquals(junitBook.isAvailability(), jsonValue.getElement("book"=
).getElement("availability")
+ .getBooleanValue());
}
=
- public void testSimpleObject3() throws Exception
+ public void testBeanCollection() throws Exception
{
- Book book =3D new Book();
- book.setAuthor("Vincent Masson");
- book.setTitle("JUnit in Action");
- book.setPages(386);
- book.setPrice(19.37);
- book.setIsdn(93011099534534L);
- book.setAvailability(true);
- book.setDelivery(true);
List l =3D new ArrayList();
- l.add(book);
- book =3D new Book();
- book.setAuthor("Christian Gross");
- book.setTitle("Beginning C# 2008 from novice to professional");
- book.setPages(511);
- book.setPrice(23.56);
- book.setIsdn(9781590598696L);
- book.setAvailability(true);
- book.setDelivery(true);
- l.add(book);
- book =3D new Book();
- book.setAuthor("Chuck Easttom");
- book.setTitle("Advanced JavaScript, Third Edition");
- book.setPages(617);
- book.setPrice(25.99);
- book.setIsdn(9781598220339L);
- book.setAvailability(true);
- book.setDelivery(true);
- l.add(book);
+ l.add(junitBook);
+ l.add(csharpBook);
+ l.add(javaScriptBook);
BookStorage bookStorage =3D new BookStorage();
bookStorage.setBooks(l);
+
JsonValue jsonValue =3D new JsonGeneratorImpl().createJsonObject(boo=
kStorage);
assertTrue(jsonValue.isObject());
Iterator iterator =3D jsonValue.getElement("books").getEl=
ements();
@@ -151,35 +154,19 @@
assertEquals(l.get(2).getTitle(), iterator.next().getElement("title"=
).getStringValue());
}
=
- public void testBeanWithCollections() throws Exception
+ public void testBeanMap() throws Exception
{
JavaMapBean mb =3D new JavaMapBean();
+
Map m =3D new HashMap();
- Book book =3D new Book();
- book.setAuthor("Vincent Masson");
- book.setTitle("JUnit in Action");
- book.setPages(386);
- book.setPrice(19.37);
- book.setIsdn(93011099534534L);
- m.put("test", book);
+ m.put("test", junitBook);
mb.setHashMap((HashMap)m);
=
List l =3D new ArrayList();
- l.add(book);
- book =3D new Book();
- book.setAuthor("Christian Gross");
- book.setTitle("Beginning C# 2008 from novice to professional");
- book.setPages(511);
- book.setPrice(23.56);
- book.setIsdn(9781590598696L);
- l.add(book);
- book =3D new Book();
- book.setAuthor("Chuck Easttom");
- book.setTitle("Advanced JavaScript, Third Edition");
- book.setPages(617);
- book.setPrice(25.99);
- book.setIsdn(9781598220339L);
- l.add(book);
+ l.add(junitBook);
+ l.add(csharpBook);
+ l.add(javaScriptBook);
+
Map> hu =3D new HashMap>();
hu.put("1", l);
hu.put("2", l);
@@ -195,31 +182,22 @@
JsonValue jsonValue =3D new JsonGeneratorImpl().createJsonObject(mb);
=
assertEquals(str.get("key2"), jsonValue.getElement("strings").getEle=
ment("key2").getStringValue());
-
assertNotNull(jsonValue.getElement("hashMap"));
-
assertNotNull(jsonValue.getElement("mapList"));
- assertEquals("JUnit in Action", jsonValue.getElement("mapList").getE=
lement("3").getElements().next().getElement(
- "title").getStringValue());
- System.out.println(jsonValue);
+ assertEquals("JUnit in Action",
+ jsonValue.getElement("mapList").getElement("3").getElements().nex=
t().getElement("title").getStringValue());
+ // System.out.println(jsonValue);
}
=
- public void testBeanWithTransientField() throws Exception
+ public void testBeanTransientField() throws Exception
{
BeanWithTransientField trBean =3D new BeanWithTransientField();
JsonValue jsonValue =3D new JsonGeneratorImpl().createJsonObject(trB=
ean);
assertEquals("visible", jsonValue.getElement("field").getStringValue=
());
- try
- {
- assertEquals("invisible", jsonValue.getElement("transientField").=
getStringValue());
- fail("It must not be serialized");
- }
- catch (NullPointerException e)
- {
- }
+ assertNull(jsonValue.getElement("transientField"));
}
=
- public void testEnumSerialization() throws Exception
+ public void testBeanEnum() throws Exception
{
BeanWithSimpleEnum be =3D new BeanWithSimpleEnum();
be.setName("name");
@@ -227,7 +205,7 @@
be.setCounts(new StringEnum[]{StringEnum.ONE, StringEnum.TWO});
be.setCountList(Arrays.asList(StringEnum.ONE, StringEnum.TWO, String=
Enum.TREE));
JsonValue jsonValue =3D new JsonGeneratorImpl().createJsonObject(be);
- System.out.println(jsonValue);
+ //System.out.println(jsonValue);
=
assertEquals("name", jsonValue.getElement("name").getStringValue());
=
@@ -255,12 +233,12 @@
assertTrue(tmp.contains(StringEnum.TREE.name()));
}
=
- public void testEnumSerialization2() throws Exception
+ public void testBeanEnumObject() throws Exception
{
BeanWithBookEnum be =3D new BeanWithBookEnum();
be.setBook(BookEnum.JUNIT_IN_ACTION);
JsonValue jsonValue =3D new JsonGeneratorImpl().createJsonObject(be);
- System.out.println(jsonValue);
+ //System.out.println(jsonValue);
assertEquals(BookEnum.JUNIT_IN_ACTION.name(), jsonValue.getElement("=
book").getStringValue());
}
=
Modified: ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/=
frameworks/json/impl/JsonParserTest.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framew=
orks/json/impl/JsonParserTest.java 2010-10-05 11:33:24 UTC (rev 3245)
+++ ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framew=
orks/json/impl/JsonParserTest.java 2010-10-05 14:59:07 UTC (rev 3246)
@@ -18,271 +18,189 @@
*/
package org.exoplatform.ws.frameworks.json.impl;
=
-import junit.framework.TestCase;
-
-import org.exoplatform.ws.frameworks.json.BeanWithBookEnum;
-import org.exoplatform.ws.frameworks.json.BeanWithSimpleEnum;
-import org.exoplatform.ws.frameworks.json.Book;
-import org.exoplatform.ws.frameworks.json.BookEnum;
-import org.exoplatform.ws.frameworks.json.BookStorage;
-import org.exoplatform.ws.frameworks.json.JavaCollectionBean;
-import org.exoplatform.ws.frameworks.json.JavaMapBean;
-import org.exoplatform.ws.frameworks.json.JsonHandler;
import org.exoplatform.ws.frameworks.json.JsonParser;
-import org.exoplatform.ws.frameworks.json.StringEnum;
import org.exoplatform.ws.frameworks.json.value.JsonValue;
+import org.exoplatform.ws.frameworks.json.value.impl.ArrayValue;
+import org.exoplatform.ws.frameworks.json.value.impl.BooleanValue;
+import org.exoplatform.ws.frameworks.json.value.impl.DoubleValue;
+import org.exoplatform.ws.frameworks.json.value.impl.LongValue;
+import org.exoplatform.ws.frameworks.json.value.impl.ObjectValue;
+import org.exoplatform.ws.frameworks.json.value.impl.StringValue;
=
import java.io.ByteArrayInputStream;
import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
=
/**
* @author Andrey Parfonov
* @version $Id: JsonParserTest.java 34417 2009-07-23 14:42:56Z dkatayev $
*/
-public class JsonParserTest extends TestCase
+public class JsonParserTest extends JsonTest
{
=
- ArrayList sourceCollection_;
-
@Override
protected void setUp() throws Exception
{
super.setUp();
- sourceCollection_ =3D new ArrayList(3);
- Book book =3D new Book();
- book.setAuthor("Vincent Masson");
- book.setTitle("JUnit in Action");
- book.setPages(386);
- book.setPrice(19.37);
- book.setIsdn(93011099534534L);
- sourceCollection_.add(book);
- Book book1 =3D new Book();
- book1.setAuthor("Christian Gross");
- book1.setTitle("Beginning C# 2008 from novice to professional");
- book1.setPages(511);
- book1.setPrice(23.56);
- book1.setIsdn(9781590598696L);
- sourceCollection_.add(book1);
- Book book2 =3D new Book();
- book2.setAuthor("Chuck Easttom");
- book2.setTitle("Advanced JavaScript. Third Edition");
- book2.setPages(617);
- book2.setPrice(25.99);
- book2.setIsdn(9781598220339L);
- sourceCollection_.add(book2);
}
=
- public void testCollection() throws Exception
+ public void testArrayString() throws Exception
{
- // test restore Collection of standard Java Object from JSON source
- JsonParserImpl jsonParser =3D new JsonParserImpl();
- String jsonString =3D
- "{" + "\"strings\":[\"JUnit in Action\",\"Advanced JavaScript\",\=
"Beginning C# 2008\"],"
- + "\"chars\":[\"b\",\"o\",\"o\",\"k\"]," + "\"integers\":[386,=
421, 565]" + "}";
- JsonHandler jsonHandler =3D new JsonDefaultHandler();
- jsonParser.parse(new InputStreamReader(new ByteArrayInputStream(json=
String.getBytes())), jsonHandler);
- JsonValue jsonValue =3D jsonHandler.getJsonObject();
- Object o =3D new BeanBuilder().createObject(JavaCollectionBean.class=
, jsonValue);
- List s =3D ((JavaCollectionBean)o).getStrings();
+ String jsonString =3D "[\"JUnit in Action\",\"Advanced JavaScript\",=
\"Beginning C# 2008\"]";
+ JsonParser jsonParser =3D new JsonParserImpl();
+
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+ jsonParser.parse(new InputStreamReader(new ByteArrayInputStream(json=
String.getBytes())), handler);
+ JsonValue jsonValue =3D handler.getJsonObject();
+
+ assertTrue(jsonValue.isArray());
+ Set s =3D new HashSet();
+ for (Iterator elements =3D jsonValue.getElements(); eleme=
nts.hasNext();)
+ {
+ JsonValue next =3D elements.next();
+ assertTrue(next.isString());
+ s.add(next.getStringValue());
+ }
assertEquals(3, s.size());
- assertEquals("JUnit in Action", s.get(0));
- assertEquals("Advanced JavaScript", s.get(1));
- assertEquals("Beginning C# 2008", s.get(2));
- List c =3D ((JavaCollectionBean)o).getChars();
- assertEquals('b', c.get(0).charValue());
- assertEquals('o', c.get(1).charValue());
- assertEquals('o', c.get(2).charValue());
- assertEquals('k', c.get(3).charValue());
- List i =3D ((JavaCollectionBean)o).getIntegers();
- assertEquals(386, i.get(0).intValue());
- assertEquals(421, i.get(1).intValue());
- assertEquals(565, i.get(2).intValue());
- // more testing for other type of Collection with custom object
+ assertTrue(s.contains("JUnit in Action"));
+ assertTrue(s.contains("Advanced JavaScript"));
+ assertTrue(s.contains("Beginning C# 2008"));
}
=
- public void testCollection2() throws Exception
+ public void testArrayLong() throws Exception
{
- // test restore Collection of other Java Object from JSON source
- JsonParserImpl jsonParser =3D new JsonParserImpl();
- // check restore different type of Collection
- JsonHandler jsonHandler =3D new JsonDefaultHandler();
- jsonParser.parse(new InputStreamReader(Thread.currentThread().getCon=
textClassLoader().getResourceAsStream(
- "CollectionTest.txt")), jsonHandler);
- JsonValue jsonValue =3D jsonHandler.getJsonObject();
- Object o =3D new BeanBuilder().createObject(JavaCollectionBean.class=
, jsonValue);
+ String jsonString =3D "[1, 0xAA, 077, 123, 32765, 77787, 123456789, =
0x123456, 0123456, -2387648, -123456789]";
=
- assertEquals(3, ((JavaCollectionBean)o).getArrayList().size());
- assertTrue(((JavaCollectionBean)o).getArrayList().get(0).equals(sour=
ceCollection_.get(0)));
- assertTrue(((JavaCollectionBean)o).getArrayList().get(1).equals(sour=
ceCollection_.get(1)));
- assertTrue(((JavaCollectionBean)o).getArrayList().get(2).equals(sour=
ceCollection_.get(2)));
+ JsonParser jsonParser =3D new JsonParserImpl();
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+ jsonParser.parse(new InputStreamReader(new ByteArrayInputStream(json=
String.getBytes())), handler);
+ JsonValue jsonValue =3D handler.getJsonObject();
=
- assertEquals(3, ((JavaCollectionBean)o).getVector().size());
- assertTrue(((JavaCollectionBean)o).getVector().get(0).equals(sourceC=
ollection_.get(0)));
- assertTrue(((JavaCollectionBean)o).getVector().get(1).equals(sourceC=
ollection_.get(1)));
- assertTrue(((JavaCollectionBean)o).getVector().get(2).equals(sourceC=
ollection_.get(2)));
-
- assertEquals(3, ((JavaCollectionBean)o).getLinkedList().size());
- assertTrue(((JavaCollectionBean)o).getLinkedList().get(0).equals(sou=
rceCollection_.get(0)));
- assertTrue(((JavaCollectionBean)o).getLinkedList().get(1).equals(sou=
rceCollection_.get(1)));
- assertTrue(((JavaCollectionBean)o).getLinkedList().get(2).equals(sou=
rceCollection_.get(2)));
-
- assertEquals(3, ((JavaCollectionBean)o).getLinkedHashSet().size());
-
- assertEquals(3, ((JavaCollectionBean)o).getHashSet().size());
-
- assertEquals(3, ((JavaCollectionBean)o).getList().size());
- assertTrue(((JavaCollectionBean)o).getList().get(0).equals(sourceCol=
lection_.get(0)));
- assertTrue(((JavaCollectionBean)o).getList().get(1).equals(sourceCol=
lection_.get(1)));
- assertTrue(((JavaCollectionBean)o).getList().get(2).equals(sourceCol=
lection_.get(2)));
-
- assertEquals(3, ((JavaCollectionBean)o).getSet().size());
-
- assertEquals(3, ((JavaCollectionBean)o).getQueue().size());
-
- assertEquals(3, ((JavaCollectionBean)o).getCollection().size());
-
- assertEquals(3, ((JavaCollectionBean)o).getArray().length);
- assertTrue(((JavaCollectionBean)o).getArray()[0].equals(sourceCollec=
tion_.get(0)));
- assertTrue(((JavaCollectionBean)o).getArray()[1].equals(sourceCollec=
tion_.get(1)));
- assertTrue(((JavaCollectionBean)o).getArray()[2].equals(sourceCollec=
tion_.get(2)));
+ assertTrue(jsonValue.isArray());
+ int i =3D 0;
+ for (Iterator elements =3D jsonValue.getElements(); eleme=
nts.hasNext(); i++)
+ {
+ JsonValue next =3D elements.next();
+ assertTrue(next.isNumeric());
+ assertTrue(next.isLong());
+ assertFalse(next.isDouble());
+ if (i =3D=3D 0)
+ assertEquals(1L, next.getLongValue());
+ if (i =3D=3D 3)
+ assertEquals(123L, next.getLongValue());
+ if (i =3D=3D 6)
+ assertEquals(123456789L, next.getLongValue());
+ }
}
=
- public void testMap() throws Exception
+ public void testArrayDouble() throws Exception
{
- JsonParserImpl jsonParser =3D new JsonParserImpl();
- JsonHandler jsonHandler =3D new JsonDefaultHandler();
String jsonString =3D
- "{" + "\"strings\":{" + "\"book\":\"Beginning C# 2008\"," + "\"au=
thor\":\"Christian Gross\"" + "},"
- + "\"integers\":{" + "\"one\":1," + "\"two\":2," + "\"three\":=
3" + "}," + "\"booleans\":{"
- + "\"true\":true," + "\"false\":false" + "}" + "}";
- jsonParser.parse(new InputStreamReader(new ByteArrayInputStream(json=
String.getBytes())), jsonHandler);
- JsonValue jsonValue =3D jsonHandler.getJsonObject();
- Object o =3D new BeanBuilder().createObject(JavaMapBean.class, jsonV=
alue);
+ "[1.0, 0.0006382746, 111111.2222222, 9999999999999.9999999999999,"
+ + "9827394873249.8, 1.23456789E8, 123456.789E8, 32154783524786=
51238.0,"
+ + "982.8, 0.00000000000023456789E8, 1.789E8, 0.000000000000000=
0000321547835247865123,"
+ + "982.8, -0.00000000000023456789E8, -1.789E-8, -0.00000000000=
00000000321547835247865123]";
=
- assertEquals("Beginning C# 2008", ((JavaMapBean)o).getStrings().get(=
"book"));
- assertEquals("Christian Gross", ((JavaMapBean)o).getStrings().get("a=
uthor"));
+ JsonParser jsonParser =3D new JsonParserImpl();
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+ jsonParser.parse(new InputStreamReader(new ByteArrayInputStream(json=
String.getBytes())), handler);
+ JsonValue jsonValue =3D handler.getJsonObject();
=
- assertEquals(1, ((JavaMapBean)o).getIntegers().get("one").intValue()=
);
- assertEquals(2, ((JavaMapBean)o).getIntegers().get("two").intValue()=
);
- assertEquals(3, ((JavaMapBean)o).getIntegers().get("three").intValue=
());
-
- assertTrue(((JavaMapBean)o).getBooleans().get("true"));
- assertFalse(((JavaMapBean)o).getBooleans().get("false"));
+ assertTrue(jsonValue.isArray());
+ int i =3D 0;
+ for (Iterator elements =3D jsonValue.getElements(); eleme=
nts.hasNext(); i++)
+ {
+ JsonValue next =3D elements.next();
+ assertTrue(next.isNumeric());
+ assertFalse(next.isLong());
+ assertTrue(next.isDouble());
+ if (i =3D=3D 0)
+ assertEquals(1.0, next.getDoubleValue());
+ if (i =3D=3D 2)
+ assertEquals(111111.2222222, next.getDoubleValue());
+ if (i =3D=3D 9)
+ assertEquals(0.00000000000023456789E8, next.getDoubleValue());
+ }
}
=
- public void testMap2() throws Exception
+ public void testArrayMixed() throws Exception
{
- JsonParserImpl jsonParser =3D new JsonParserImpl();
- JsonHandler jsonHandler =3D new JsonDefaultHandler();
- jsonParser.parse(new InputStreamReader(Thread.currentThread().getCon=
textClassLoader().getResourceAsStream(
- "MapTest.txt")), jsonHandler);
- JsonValue jv =3D jsonHandler.getJsonObject();
- Object o =3D new BeanBuilder().createObject(JavaMapBean.class, jv);
+ String jsonString =3D "[1.0, \"to be or not to be\", 111, true, {\"o=
bject\":{\"foo\":\"bar\"}}]";
=
- assertTrue(((JavaMapBean)o).getMap().get("JUnit").equals(sourceColle=
ction_.get(0)));
- assertTrue(((JavaMapBean)o).getMap().get("C#").equals(sourceCollecti=
on_.get(1)));
- assertTrue(((JavaMapBean)o).getMap().get("JavaScript").equals(source=
Collection_.get(2)));
+ JsonParser jsonParser =3D new JsonParserImpl();
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+ jsonParser.parse(new InputStreamReader(new ByteArrayInputStream(json=
String.getBytes())), handler);
+ JsonValue jsonValue =3D handler.getJsonObject();
=
- assertTrue(((JavaMapBean)o).getHashMap().get("JUnit").equals(sourceC=
ollection_.get(0)));
- assertTrue(((JavaMapBean)o).getHashMap().get("C#").equals(sourceColl=
ection_.get(1)));
- assertTrue(((JavaMapBean)o).getHashMap().get("JavaScript").equals(so=
urceCollection_.get(2)));
+ assertTrue(jsonValue.isArray());
+ ArrayValue exp =3D new ArrayValue();
+ exp.addElement(new DoubleValue(1.0D));
+ exp.addElement(new StringValue("to be or not to be"));
+ exp.addElement(new LongValue(111));
+ exp.addElement(new BooleanValue(true));
+ ObjectValue o =3D new ObjectValue();
+ o.addElement("foo", new StringValue("bar"));
+ ObjectValue o1 =3D new ObjectValue();
+ o1.addElement("object", o);
+ exp.addElement(o1);
=
- assertTrue(((JavaMapBean)o).getHashtable().get("JUnit").equals(sourc=
eCollection_.get(0)));
- assertTrue(((JavaMapBean)o).getHashtable().get("C#").equals(sourceCo=
llection_.get(1)));
- assertTrue(((JavaMapBean)o).getHashtable().get("JavaScript").equals(=
sourceCollection_.get(2)));
-
- assertTrue(((JavaMapBean)o).getLinkedHashMap().get("JUnit").equals(s=
ourceCollection_.get(0)));
- assertTrue(((JavaMapBean)o).getLinkedHashMap().get("C#").equals(sour=
ceCollection_.get(1)));
- assertTrue(((JavaMapBean)o).getLinkedHashMap().get("JavaScript").equ=
als(sourceCollection_.get(2)));
-
+ Iterator elements =3D jsonValue.getElements();
+ Iterator expElements =3D jsonValue.getElements();
+ for (; elements.hasNext() && expElements.hasNext();)
+ {
+ JsonValue next =3D elements.next();
+ JsonValue expNext =3D expElements.next();
+ assertEquals(expNext.toString(), next.toString());
+ }
+ // Both must be empty
+ assertFalse(elements.hasNext() || expElements.hasNext());
}
=
- public void testBean() throws Exception
+ public void testObject() throws Exception
{
- JsonParserImpl jsonParser =3D new JsonParserImpl();
- JsonHandler jsonHandler =3D new JsonDefaultHandler();
- jsonParser.parse(new InputStreamReader(Thread.currentThread().getCon=
textClassLoader().getResourceAsStream(
- "BookStorage.txt")), jsonHandler);
- JsonValue jv =3D jsonHandler.getJsonObject();
- Object o =3D new BeanBuilder().createObject(BookStorage.class, jv);
- assertTrue(((BookStorage)o).getBooks().get(0).equals(sourceCollectio=
n_.get(0)));
- assertTrue(((BookStorage)o).getBooks().get(1).equals(sourceCollectio=
n_.get(1)));
- assertTrue(((BookStorage)o).getBooks().get(2).equals(sourceCollectio=
n_.get(2)));
- }
+ String jsonString =3D
+ "{\"foo\":\"bar\", \"book\":{\"author\":\"Christian Gross\",\"tit=
le\":\"Beginning C# 2008\"}}";
=
- public void testMultiDimensionArray() throws Exception
- {
JsonParser jsonParser =3D new JsonParserImpl();
- JsonHandler jsonHandler =3D new JsonDefaultHandler();
- jsonParser.parse(new InputStreamReader(Thread.currentThread().getCon=
textClassLoader().getResourceAsStream(
- "MultiDimension.txt")), jsonHandler);
- JsonValue jsonValue =3D jsonHandler.getJsonObject();
- // System.out.println(jsonValue);
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+ jsonParser.parse(new InputStreamReader(new ByteArrayInputStream(json=
String.getBytes())), handler);
+ JsonValue jsonValue =3D handler.getJsonObject();
+
assertTrue(jsonValue.isObject());
- assertTrue(jsonValue.getElement("books").isArray());
- assertTrue(jsonValue.getElement("books").getElements().next().isArra=
y());
- assertTrue(jsonValue.getElement("books").getElements().next().getEle=
ments().next().isArray());
- assertTrue(jsonValue.getElement("books").getElements().next().getEle=
ments().next().getElements().next()
- .isObject());
- assertEquals("JUnit in Action", jsonValue.getElement("books").getEle=
ments().next().getElements().next()
- .getElements().next().getElement("title").getStringValue());
+ JsonValue sValue =3D jsonValue.getElement("foo");
+ assertTrue(sValue.isString());
+ assertEquals("bar", sValue.getStringValue());
+ JsonValue bookValue =3D jsonValue.getElement("book");
+ assertTrue(bookValue.isObject());
+ assertEquals("Beginning C# 2008", bookValue.getElement("title").getS=
tringValue());
+ assertEquals("Christian Gross", bookValue.getElement("author").getSt=
ringValue());
}
=
- public void testEnumSerialization() throws Exception
+ public void testMultiDimensionArray() throws Exception
{
- String source =3D
- "{\"countList\":[\"ONE\",\"TWO\",\"TREE\"], \"name\":\"andrew\",\=
"count\":\"TREE\",\"counts\":[\"TWO\",\"TREE\"]}";
- JsonParser parser =3D new JsonParserImpl();
- JsonHandler jsonHandler =3D new JsonDefaultHandler();
- parser.parse(new ByteArrayInputStream(source.getBytes()), jsonHandle=
r);
- JsonValue jsonValue =3D jsonHandler.getJsonObject();
- // System.out.println(jsonValue);
+ String jsonString =3D "[\"foo0\", [\"foo1\", \"bar1\", [\"foo2\", \"=
bar2\"]], \"bar0\"]";
=
- BeanWithSimpleEnum o =3D (BeanWithSimpleEnum)new BeanBuilder().creat=
eObject(BeanWithSimpleEnum.class, jsonValue);
+ JsonParser jsonParser =3D new JsonParserImpl();
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+ jsonParser.parse(new InputStreamReader(new ByteArrayInputStream(json=
String.getBytes())), handler);
+ JsonValue jsonValue =3D handler.getJsonObject();
+ //System.out.println(jsonValue);
=
- assertEquals("andrew", o.getName());
+ ArrayValue exp =3D new ArrayValue();
+ exp.addElement(new StringValue("foo0"));
+ ArrayValue l1 =3D new ArrayValue();
+ exp.addElement(l1);
+ l1.addElement(new StringValue("foo1"));
+ l1.addElement(new StringValue("bar1"));
+ ArrayValue l2 =3D new ArrayValue();
+ l1.addElement(l2);
+ l2.addElement(new StringValue("foo2"));
+ l2.addElement(new StringValue("bar2"));
+ exp.addElement(new StringValue("bar0"));
=
- assertEquals(StringEnum.TREE, o.getCount());
-
- StringEnum[] counts =3D o.getCounts();
- assertEquals(2, counts.length);
-
- List tmp =3D Arrays.asList(counts);
- assertTrue(tmp.contains(StringEnum.TWO));
- assertTrue(tmp.contains(StringEnum.TREE));
-
- tmp =3D o.getCountList();
- assertEquals(3, tmp.size());
- assertTrue(tmp.contains(StringEnum.ONE));
- assertTrue(tmp.contains(StringEnum.TWO));
- assertTrue(tmp.contains(StringEnum.TREE));
+ assertEquals(exp.toString(), jsonValue.toString());
}
=
- public void testEnumSerialization2() throws Exception
- {
- String source =3D "{\"book\":\"BEGINNING_C\"}";
- JsonParser parser =3D new JsonParserImpl();
- JsonHandler jsonHandler =3D new JsonDefaultHandler();
- parser.parse(new ByteArrayInputStream(source.getBytes()), jsonHandle=
r);
- JsonValue jsonValue =3D jsonHandler.getJsonObject();
- //System.out.println(jsonValue);
- BeanWithBookEnum o =3D (BeanWithBookEnum)new BeanBuilder().createObj=
ect(BeanWithBookEnum.class, jsonValue);
- assertEquals(BookEnum.BEGINNING_C, o.getBook());
- }
- =
- public void testArray() throws Exception
- {
- String source =3D "{\"array\":[\"a\",\"b\",\"c\"]}";
- JsonParser parser =3D new JsonParserImpl();
- JsonHandler jsonHandler =3D new JsonDefaultHandler();
- parser.parse(new ByteArrayInputStream(source.getBytes()), jsonHandle=
r);
- JsonValue jsonValue =3D jsonHandler.getJsonObject();
- System.out.println(jsonValue.getElement("array").isArray());
- =
- =
- }
-
}
Added: ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/fra=
meworks/json/impl/JsonTest.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framew=
orks/json/impl/JsonTest.java (rev 0)
+++ ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framew=
orks/json/impl/JsonTest.java 2010-10-05 14:59:07 UTC (rev 3246)
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.ws.frameworks.json.impl;
+
+import junit.framework.TestCase;
+
+import org.exoplatform.ws.frameworks.json.Book;
+
+/**
+ * @author Andrey Parfonov
+ * @version $Id$
+ */
+public abstract class JsonTest extends TestCase
+{
+
+ protected Book junitBook;
+
+ protected Book csharpBook;
+
+ protected Book javaScriptBook;
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ junitBook =3D new Book();
+ junitBook.setAuthor("Vincent Masson");
+ junitBook.setTitle("JUnit in Action");
+ junitBook.setPages(386);
+ junitBook.setPrice(19.37);
+ junitBook.setIsdn(93011099534534L);
+ junitBook.setAvailability(false);
+ junitBook.setDelivery(false);
+
+ csharpBook =3D new Book();
+ csharpBook.setAuthor("Christian Gross");
+ csharpBook.setTitle("Beginning C# 2008 from novice to professional");
+ csharpBook.setPages(511);
+ csharpBook.setPrice(23.56);
+ csharpBook.setIsdn(9781590598696L);
+ csharpBook.setAvailability(false);
+ csharpBook.setDelivery(false);
+
+ javaScriptBook =3D new Book();
+ javaScriptBook.setAuthor("Chuck Easttom");
+ javaScriptBook.setTitle("Advanced JavaScript. Third Edition");
+ javaScriptBook.setPages(617);
+ javaScriptBook.setPrice(25.99);
+ javaScriptBook.setIsdn(9781598220339L);
+ javaScriptBook.setAvailability(false);
+ javaScriptBook.setDelivery(false);
+ }
+
+}
Property changes on: ws/trunk/exo.ws.frameworks.json/src/test/java/org/exop=
latform/ws/frameworks/json/impl/JsonTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/=
frameworks/json/impl/JsonUtilsTest.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framew=
orks/json/impl/JsonUtilsTest.java 2010-10-05 11:33:24 UTC (rev 3245)
+++ ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framew=
orks/json/impl/JsonUtilsTest.java 2010-10-05 14:59:07 UTC (rev 3246)
@@ -18,13 +18,11 @@
*/
package org.exoplatform.ws.frameworks.json.impl;
=
-import junit.framework.TestCase;
-
/**
* @author Andrey Parfonov
* @version $Id: JsonUtilsTest.java 34417 2009-07-23 14:42:56Z dkatayev $
*/
-public class JsonUtilsTest extends TestCase
+public class JsonUtilsTest extends JsonTest
{
=
@Override
@@ -42,34 +40,34 @@
assertEquals(JsonUtils.getJsonString("str\\ing"), "\"str\\\\ing\"");
assertEquals(JsonUtils.getJsonString("stri\"ng"), "\"stri\\\"ng\"");
assertEquals(JsonUtils.getJsonString("stri/ng"), "\"stri/ng\"");
- int i =3D 0;
- for (char c =3D '\u0000'; c < '\u0020'; c++, i++)
- {
- System.out.print(JsonUtils.getJsonString(c + "") + " ");
- if (i > 10)
- {
- System.out.println();
- i =3D 0;
- }
- }
- for (char c =3D '\u0080'; c < '\u00a0'; c++, i++)
- {
- System.out.print(JsonUtils.getJsonString(c + " "));
- if (i > 10)
- {
- System.out.println();
- i =3D 0;
- }
- }
- for (char c =3D '\u2000'; c < '\u2100'; c++, i++)
- {
- System.out.print(JsonUtils.getJsonString(c + " "));
- if (i > 10)
- {
- System.out.println();
- i =3D 0;
- }
- }
+ // int i =3D 0;
+ // for (char c =3D '\u0000'; c < '\u0020'; c++, i++)
+ // {
+ // System.out.print(JsonUtils.getJsonString(c + "") + " ");
+ // if (i > 10)
+ // {
+ // System.out.println();
+ // i =3D 0;
+ // }
+ // }
+ // for (char c =3D '\u0080'; c < '\u00a0'; c++, i++)
+ // {
+ // System.out.print(JsonUtils.getJsonString(c + " "));
+ // if (i > 10)
+ // {
+ // System.out.println();
+ // i =3D 0;
+ // }
+ // }
+ // for (char c =3D '\u2000'; c < '\u2100'; c++, i++)
+ // {
+ // System.out.print(JsonUtils.getJsonString(c + " "));
+ // if (i > 10)
+ // {
+ // System.out.println();
+ // i =3D 0;
+ // }
+ // }
}
=
}
Modified: ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/=
frameworks/json/impl/JsonWriterTest.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framew=
orks/json/impl/JsonWriterTest.java 2010-10-05 11:33:24 UTC (rev 3245)
+++ ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framew=
orks/json/impl/JsonWriterTest.java 2010-10-05 14:59:07 UTC (rev 3246)
@@ -18,15 +18,13 @@
*/
package org.exoplatform.ws.frameworks.json.impl;
=
-import junit.framework.TestCase;
-
import java.io.ByteArrayOutputStream;
=
/**
* @author Andrey Parfonov
* @version $Id: JsonWriterTest.java 34417 2009-07-23 14:42:56Z dkatayev $
*/
-public class JsonWriterTest extends TestCase
+public class JsonWriterTest extends JsonTest
{
=
@Override
Added: ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/fra=
meworks/json/impl/ObjectBuilderTest.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framew=
orks/json/impl/ObjectBuilderTest.java (rev 0)
+++ ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framew=
orks/json/impl/ObjectBuilderTest.java 2010-10-05 14:59:07 UTC (rev 3246)
@@ -0,0 +1,363 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.ws.frameworks.json.impl;
+
+import org.exoplatform.ws.frameworks.json.BeanWithBookEnum;
+import org.exoplatform.ws.frameworks.json.BeanWithSimpleEnum;
+import org.exoplatform.ws.frameworks.json.Book;
+import org.exoplatform.ws.frameworks.json.BookEnum;
+import org.exoplatform.ws.frameworks.json.BookStorage;
+import org.exoplatform.ws.frameworks.json.JavaCollectionBean;
+import org.exoplatform.ws.frameworks.json.JavaMapBean;
+import org.exoplatform.ws.frameworks.json.JsonParser;
+import org.exoplatform.ws.frameworks.json.StringEnum;
+import org.exoplatform.ws.frameworks.json.value.JsonValue;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @author Andrey Parfonov
+ * @version $Id$
+ */
+public class ObjectBuilderTest extends JsonTest
+{
+ private ArrayList sourceCollection;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ sourceCollection =3D new ArrayList(3);
+ sourceCollection.add(junitBook);
+ sourceCollection.add(csharpBook);
+ sourceCollection.add(javaScriptBook);
+ }
+
+ public void testCollectionArrayList() throws Exception
+ {
+ JsonParser jsonParser =3D new JsonParserImpl();
+ // check restore different type of Collection
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+ jsonParser.parse(new InputStreamReader(Thread.currentThread().getCon=
textClassLoader().getResourceAsStream(
+ "CollectionTest.txt")), handler);
+ JsonValue jsonValue =3D handler.getJsonObject();
+
+ JavaCollectionBean o =3D ObjectBuilder.createObject(JavaCollectionBe=
an.class, jsonValue);
+
+ assertEquals(3, o.getArrayList().size());
+ assertTrue(o.getArrayList().get(0).equals(sourceCollection.get(0)));
+ assertTrue(o.getArrayList().get(1).equals(sourceCollection.get(1)));
+ assertTrue(o.getArrayList().get(2).equals(sourceCollection.get(2)));
+ }
+
+ public void testCollectionVector() throws Exception
+ {
+ JsonParser jsonParser =3D new JsonParserImpl();
+ // check restore different type of Collection
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+ jsonParser.parse(new InputStreamReader(Thread.currentThread().getCon=
textClassLoader().getResourceAsStream(
+ "CollectionTest.txt")), handler);
+ JsonValue jsonValue =3D handler.getJsonObject();
+
+ JavaCollectionBean o =3D ObjectBuilder.createObject(JavaCollectionBe=
an.class, jsonValue);
+
+ assertEquals(3, o.getVector().size());
+ assertTrue(o.getVector().get(0).equals(sourceCollection.get(0)));
+ assertTrue(o.getVector().get(1).equals(sourceCollection.get(1)));
+ assertTrue(o.getVector().get(2).equals(sourceCollection.get(2)));
+ }
+
+ public void testCollectionLinkedList() throws Exception
+ {
+ JsonParser jsonParser =3D new JsonParserImpl();
+ // check restore different type of Collection
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+ jsonParser.parse(new InputStreamReader(Thread.currentThread().getCon=
textClassLoader().getResourceAsStream(
+ "CollectionTest.txt")), handler);
+ JsonValue jsonValue =3D handler.getJsonObject();
+
+ JavaCollectionBean o =3D ObjectBuilder.createObject(JavaCollectionBe=
an.class, jsonValue);
+
+ assertEquals(3, o.getLinkedList().size());
+ assertTrue(o.getLinkedList().get(0).equals(sourceCollection.get(0)));
+ assertTrue(o.getLinkedList().get(1).equals(sourceCollection.get(1)));
+ assertTrue(o.getLinkedList().get(2).equals(sourceCollection.get(2)));
+ }
+
+ public void testCollectionLinkedHashSet() throws Exception
+ {
+ JsonParser jsonParser =3D new JsonParserImpl();
+ // check restore different type of Collection
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+ jsonParser.parse(new InputStreamReader(Thread.currentThread().getCon=
textClassLoader().getResourceAsStream(
+ "CollectionTest.txt")), handler);
+ JsonValue jsonValue =3D handler.getJsonObject();
+
+ JavaCollectionBean o =3D ObjectBuilder.createObject(JavaCollectionBe=
an.class, jsonValue);
+
+ assertEquals(3, o.getLinkedHashSet().size());
+ assertTrue(o.getLinkedHashSet().contains(sourceCollection.get(0)));
+ assertTrue(o.getLinkedHashSet().contains(sourceCollection.get(1)));
+ assertTrue(o.getLinkedHashSet().contains(sourceCollection.get(2)));
+ }
+
+ public void testCollectionHashSet() throws Exception
+ {
+ JsonParser jsonParser =3D new JsonParserImpl();
+ // check restore different type of Collection
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+ jsonParser.parse(new InputStreamReader(Thread.currentThread().getCon=
textClassLoader().getResourceAsStream(
+ "CollectionTest.txt")), handler);
+ JsonValue jsonValue =3D handler.getJsonObject();
+
+ JavaCollectionBean o =3D ObjectBuilder.createObject(JavaCollectionBe=
an.class, jsonValue);
+
+ assertEquals(3, o.getHashSet().size());
+ assertTrue(o.getHashSet().contains(sourceCollection.get(0)));
+ assertTrue(o.getHashSet().contains(sourceCollection.get(1)));
+ assertTrue(o.getHashSet().contains(sourceCollection.get(2)));
+ }
+
+ public void testCollectionList() throws Exception
+ {
+ JsonParser jsonParser =3D new JsonParserImpl();
+ // check restore different type of Collection
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+ jsonParser.parse(new InputStreamReader(Thread.currentThread().getCon=
textClassLoader().getResourceAsStream(
+ "CollectionTest.txt")), handler);
+ JsonValue jsonValue =3D handler.getJsonObject();
+
+ JavaCollectionBean o =3D ObjectBuilder.createObject(JavaCollectionBe=
an.class, jsonValue);
+
+ assertEquals(3, o.getList().size());
+ assertTrue(o.getList().get(0).equals(sourceCollection.get(0)));
+ assertTrue(o.getList().get(1).equals(sourceCollection.get(1)));
+ assertTrue(o.getList().get(2).equals(sourceCollection.get(2)));
+ }
+
+ public void testCollectionSet() throws Exception
+ {
+ JsonParser jsonParser =3D new JsonParserImpl();
+ // check restore different type of Collection
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+ jsonParser.parse(new InputStreamReader(Thread.currentThread().getCon=
textClassLoader().getResourceAsStream(
+ "CollectionTest.txt")), handler);
+ JsonValue jsonValue =3D handler.getJsonObject();
+
+ JavaCollectionBean o =3D ObjectBuilder.createObject(JavaCollectionBe=
an.class, jsonValue);
+
+ assertEquals(3, o.getSet().size());
+ assertTrue(o.getSet().contains(sourceCollection.get(0)));
+ assertTrue(o.getSet().contains(sourceCollection.get(1)));
+ assertTrue(o.getSet().contains(sourceCollection.get(2)));
+ }
+
+ public void testCollectionQueue() throws Exception
+ {
+ JsonParser jsonParser =3D new JsonParserImpl();
+ // check restore different type of Collection
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+ jsonParser.parse(new InputStreamReader(Thread.currentThread().getCon=
textClassLoader().getResourceAsStream(
+ "CollectionTest.txt")), handler);
+ JsonValue jsonValue =3D handler.getJsonObject();
+
+ JavaCollectionBean o =3D ObjectBuilder.createObject(JavaCollectionBe=
an.class, jsonValue);
+
+ assertEquals(3, o.getQueue().size());
+ assertTrue(o.getQueue().contains(sourceCollection.get(0)));
+ assertTrue(o.getQueue().contains(sourceCollection.get(1)));
+ assertTrue(o.getQueue().contains(sourceCollection.get(2)));
+ }
+
+ public void testCollectionCollection() throws Exception
+ {
+ JsonParser jsonParser =3D new JsonParserImpl();
+ // check restore different type of Collection
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+ jsonParser.parse(new InputStreamReader(Thread.currentThread().getCon=
textClassLoader().getResourceAsStream(
+ "CollectionTest.txt")), handler);
+ JsonValue jsonValue =3D handler.getJsonObject();
+
+ JavaCollectionBean o =3D ObjectBuilder.createObject(JavaCollectionBe=
an.class, jsonValue);
+
+ assertEquals(3, o.getCollection().size());
+ assertTrue(o.getCollection().contains(sourceCollection.get(0)));
+ assertTrue(o.getCollection().contains(sourceCollection.get(1)));
+ assertTrue(o.getCollection().contains(sourceCollection.get(2)));
+ }
+
+ public void testCollectionArray() throws Exception
+ {
+ JsonParser jsonParser =3D new JsonParserImpl();
+ // check restore different type of Collection
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+ jsonParser.parse(new InputStreamReader(Thread.currentThread().getCon=
textClassLoader().getResourceAsStream(
+ "CollectionTest.txt")), handler);
+ JsonValue jsonValue =3D handler.getJsonObject();
+
+ JavaCollectionBean o =3D ObjectBuilder.createObject(JavaCollectionBe=
an.class, jsonValue);
+
+ assertEquals(3, o.getArray().length);
+ assertTrue(o.getArray()[0].equals(sourceCollection.get(0)));
+ assertTrue(o.getArray()[1].equals(sourceCollection.get(1)));
+ assertTrue(o.getArray()[2].equals(sourceCollection.get(2)));
+ }
+
+ public void testMap2() throws Exception
+ {
+ JsonParser jsonParser =3D new JsonParserImpl();
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+ jsonParser.parse(new InputStreamReader(Thread.currentThread().getCon=
textClassLoader().getResourceAsStream(
+ "MapTest.txt")), handler);
+ JsonValue jv =3D handler.getJsonObject();
+ JavaMapBean o =3D ObjectBuilder.createObject(JavaMapBean.class, jv);
+
+ assertTrue(o.getMap().get("JUnit").equals(sourceCollection.get(0)));
+ assertTrue(o.getMap().get("C#").equals(sourceCollection.get(1)));
+ assertTrue(o.getMap().get("JavaScript").equals(sourceCollection.get(=
2)));
+
+ assertTrue(o.getHashMap().get("JUnit").equals(sourceCollection.get(0=
)));
+ assertTrue(o.getHashMap().get("C#").equals(sourceCollection.get(1)));
+ assertTrue(o.getHashMap().get("JavaScript").equals(sourceCollection.=
get(2)));
+
+ assertTrue(o.getHashtable().get("JUnit").equals(sourceCollection.get=
(0)));
+ assertTrue(o.getHashtable().get("C#").equals(sourceCollection.get(1)=
));
+ assertTrue(o.getHashtable().get("JavaScript").equals(sourceCollectio=
n.get(2)));
+
+ assertTrue(o.getLinkedHashMap().get("JUnit").equals(sourceCollection=
.get(0)));
+ assertTrue(o.getLinkedHashMap().get("C#").equals(sourceCollection.ge=
t(1)));
+ assertTrue(o.getLinkedHashMap().get("JavaScript").equals(sourceColle=
ction.get(2)));
+
+ }
+
+ public void testMapMap() throws Exception
+ {
+ JsonParser jsonParser =3D new JsonParserImpl();
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+ jsonParser.parse(new InputStreamReader(Thread.currentThread().getCon=
textClassLoader().getResourceAsStream(
+ "MapTest.txt")), handler);
+ JsonValue jv =3D handler.getJsonObject();
+ JavaMapBean o =3D ObjectBuilder.createObject(JavaMapBean.class, jv);
+
+ assertTrue(o.getMap().get("JUnit").equals(sourceCollection.get(0)));
+ assertTrue(o.getMap().get("C#").equals(sourceCollection.get(1)));
+ assertTrue(o.getMap().get("JavaScript").equals(sourceCollection.get(=
2)));
+ }
+
+ public void testMapHashMap() throws Exception
+ {
+ JsonParser jsonParser =3D new JsonParserImpl();
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+ jsonParser.parse(new InputStreamReader(Thread.currentThread().getCon=
textClassLoader().getResourceAsStream(
+ "MapTest.txt")), handler);
+ JsonValue jv =3D handler.getJsonObject();
+ JavaMapBean o =3D ObjectBuilder.createObject(JavaMapBean.class, jv);
+
+ assertTrue(o.getHashMap().get("JUnit").equals(sourceCollection.get(0=
)));
+ assertTrue(o.getHashMap().get("C#").equals(sourceCollection.get(1)));
+ assertTrue(o.getHashMap().get("JavaScript").equals(sourceCollection.=
get(2)));
+ }
+
+ public void testMapHashtable() throws Exception
+ {
+ JsonParser jsonParser =3D new JsonParserImpl();
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+ jsonParser.parse(new InputStreamReader(Thread.currentThread().getCon=
textClassLoader().getResourceAsStream(
+ "MapTest.txt")), handler);
+ JsonValue jv =3D handler.getJsonObject();
+ JavaMapBean o =3D ObjectBuilder.createObject(JavaMapBean.class, jv);
+
+ assertTrue(o.getHashtable().get("JUnit").equals(sourceCollection.get=
(0)));
+ assertTrue(o.getHashtable().get("C#").equals(sourceCollection.get(1)=
));
+ assertTrue(o.getHashtable().get("JavaScript").equals(sourceCollectio=
n.get(2)));
+ }
+
+ public void testMapLinkedHashMap() throws Exception
+ {
+ JsonParser jsonParser =3D new JsonParserImpl();
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+ jsonParser.parse(new InputStreamReader(Thread.currentThread().getCon=
textClassLoader().getResourceAsStream(
+ "MapTest.txt")), handler);
+ JsonValue jv =3D handler.getJsonObject();
+ JavaMapBean o =3D ObjectBuilder.createObject(JavaMapBean.class, jv);
+
+ assertTrue(o.getLinkedHashMap().get("JUnit").equals(sourceCollection=
.get(0)));
+ assertTrue(o.getLinkedHashMap().get("C#").equals(sourceCollection.ge=
t(1)));
+ assertTrue(o.getLinkedHashMap().get("JavaScript").equals(sourceColle=
ction.get(2)));
+ }
+
+ public void testBean() throws Exception
+ {
+ JsonParser jsonParser =3D new JsonParserImpl();
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+ jsonParser.parse(new InputStreamReader(Thread.currentThread().getCon=
textClassLoader().getResourceAsStream(
+ "BookStorage.txt")), handler);
+ JsonValue jv =3D handler.getJsonObject();
+ BookStorage o =3D ObjectBuilder.createObject(BookStorage.class, jv);
+ assertTrue(o.getBooks().get(0).equals(sourceCollection.get(0)));
+ assertTrue(o.getBooks().get(1).equals(sourceCollection.get(1)));
+ assertTrue(o.getBooks().get(2).equals(sourceCollection.get(2)));
+ }
+
+ public void testEnumSerialization() throws Exception
+ {
+ String source =3D
+ "{\"countList\":[\"ONE\",\"TWO\",\"TREE\"], \"name\":\"andrew\",\=
"count\":\"TREE\",\"counts\":[\"TWO\",\"TREE\"]}";
+ JsonParser jsonParser =3D new JsonParserImpl();
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+ jsonParser.parse(new ByteArrayInputStream(source.getBytes()), handle=
r);
+ JsonValue jsonValue =3D handler.getJsonObject();
+ //System.out.println(jsonValue);
+
+ BeanWithSimpleEnum o =3D ObjectBuilder.createObject(BeanWithSimpleEn=
um.class, jsonValue);
+
+ assertEquals("andrew", o.getName());
+
+ assertEquals(StringEnum.TREE, o.getCount());
+
+ StringEnum[] counts =3D o.getCounts();
+ assertEquals(2, counts.length);
+
+ List tmp =3D Arrays.asList(counts);
+ assertTrue(tmp.contains(StringEnum.TWO));
+ assertTrue(tmp.contains(StringEnum.TREE));
+
+ tmp =3D o.getCountList();
+ assertEquals(3, tmp.size());
+ assertTrue(tmp.contains(StringEnum.ONE));
+ assertTrue(tmp.contains(StringEnum.TWO));
+ assertTrue(tmp.contains(StringEnum.TREE));
+ }
+
+ public void testEnumSerialization2() throws Exception
+ {
+ String source =3D "{\"book\":\"BEGINNING_C\"}";
+ JsonParser jsonParser =3D new JsonParserImpl();
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+ jsonParser.parse(new ByteArrayInputStream(source.getBytes()), handle=
r);
+ JsonValue jsonValue =3D handler.getJsonObject();
+ //System.out.println(jsonValue);
+ BeanWithBookEnum o =3D ObjectBuilder.createObject(BeanWithBookEnum.c=
lass, jsonValue);
+ assertEquals(BookEnum.BEGINNING_C, o.getBook());
+ }
+}
Property changes on: ws/trunk/exo.ws.frameworks.json/src/test/java/org/exop=
latform/ws/frameworks/json/impl/ObjectBuilderTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/=
frameworks/json/impl/TransferJavaBeanTest.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framew=
orks/json/impl/TransferJavaBeanTest.java 2010-10-05 11:33:24 UTC (rev 3245)
+++ ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framew=
orks/json/impl/TransferJavaBeanTest.java 2010-10-05 14:59:07 UTC (rev 3246)
@@ -18,8 +18,6 @@
*/
package org.exoplatform.ws.frameworks.json.impl;
=
-import junit.framework.TestCase;
-
import org.exoplatform.ws.frameworks.json.Book;
import org.exoplatform.ws.frameworks.json.JsonHandler;
import org.exoplatform.ws.frameworks.json.JsonParser;
@@ -33,7 +31,7 @@
* @author Andrey Parfonov
* @version $Id: TransferJavaBeanTest.java 34417 2009-07-23 14:42:56Z dkat=
ayev $
*/
-public class TransferJavaBeanTest extends TestCase
+public class TransferJavaBeanTest extends JsonTest
{
=
@Override
@@ -71,7 +69,7 @@
=
jsonParser.parse(in, jsonHandler);
JsonValue jsonValue =3D jsonHandler.getJsonObject();
- Book newBook =3D (Book)new BeanBuilder().createObject(Book.class, js=
onValue);
+ Book newBook =3D ObjectBuilder.createObject(Book.class, jsonValue);
assertEquals(author, newBook.getAuthor());
assertEquals(title, newBook.getTitle());
assertEquals(pages, newBook.getPages());
Modified: ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/=
frameworks/json/impl/groovy/GroovyBeanTest.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framew=
orks/json/impl/groovy/GroovyBeanTest.java 2010-10-05 11:33:24 UTC (rev 3245)
+++ ws/trunk/exo.ws.frameworks.json/src/test/java/org/exoplatform/ws/framew=
orks/json/impl/groovy/GroovyBeanTest.java 2010-10-05 14:59:07 UTC (rev 3246)
@@ -23,10 +23,10 @@
import junit.framework.TestCase;
=
import org.exoplatform.ws.frameworks.json.JsonHandler;
-import org.exoplatform.ws.frameworks.json.impl.BeanBuilder;
import org.exoplatform.ws.frameworks.json.impl.JsonDefaultHandler;
import org.exoplatform.ws.frameworks.json.impl.JsonGeneratorImpl;
import org.exoplatform.ws.frameworks.json.impl.JsonParserImpl;
+import org.exoplatform.ws.frameworks.json.impl.ObjectBuilder;
import org.exoplatform.ws.frameworks.json.value.JsonValue;
import org.exoplatform.ws.frameworks.json.value.impl.ObjectValue;
import org.exoplatform.ws.frameworks.json.value.impl.StringValue;
@@ -46,7 +46,7 @@
JsonValue ov =3D new ObjectValue();
StringValue sv =3D new StringValue("test restore groovy bean");
ov.addElement("value", sv);
- assertEquals("test restore groovy bean", new BeanBuilder().createObj=
ect(c, ov).toString());
+ assertEquals("test restore groovy bean", ObjectBuilder.createObject(=
c, ov).toString());
}
=
@SuppressWarnings("unchecked")
@@ -89,7 +89,7 @@
jsonParser.parse(new InputStreamReader(Thread.currentThread().getCon=
textClassLoader().getResourceAsStream(
"BookStorage.txt")), jsonHandler);
JsonValue jv =3D jsonHandler.getJsonObject();
- GroovyObject o =3D (GroovyObject)new BeanBuilder().createObject(c, j=
v);
+ GroovyObject o =3D (GroovyObject)ObjectBuilder.createObject(c, jv);
//System.out.println(o);
List books =3D (List)o.getProperty("book=
s");
assertEquals(3, books.size());
Deleted: ws/trunk/exo.ws.frameworks.json/src/test/resources/MultiDimension.=
txt
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/trunk/exo.ws.frameworks.json/src/test/resources/MultiDimension.txt 2=
010-10-05 11:33:24 UTC (rev 3245)
+++ ws/trunk/exo.ws.frameworks.json/src/test/resources/MultiDimension.txt 2=
010-10-05 14:59:07 UTC (rev 3246)
@@ -1,36 +0,0 @@
-/* don't edit me */
-{
-"books":[
-[
- [ {"title":"JUnit in Action","pages":386,"isdn":93011099534534,"price":1=
9.37,"author":"Vincent Masson"},
- {"title":"Beginning C# 2008 from novice to professional","pages":511,"=
isdn":9781590598696,"price":23.56,"author":"Christian Gross"},
- {"title":"Advanced JavaScript. Third Edition","pages":617,"isdn":97815=
98220339,"price":25.99,"author":"Chuck Easttom"}],
- [ {"title":"JUnit in Action","pages":386,"isdn":93011099534534,"price":1=
9.37,"author":"Vincent Masson"},
- {"title":"Beginning C# 2008 from novice to professional","pages":511,"=
isdn":9781590598696,"price":23.56,"author":"Christian Gross"},
- {"title":"Advanced JavaScript. Third Edition","pages":617,"isdn":97815=
98220339,"price":25.99,"author":"Chuck Easttom"},
- {"title":"JUnit in Action","pages":386,"isdn":93011099534534,"price":1=
9.37,"author":"Vincent Masson"},
- {"title":"Beginning C# 2008 from novice to professional","pages":511,"=
isdn":9781590598696,"price":23.56,"author":"Christian Gross"},
- {"title":"Advanced JavaScript. Third Edition","pages":617,"isdn":97815=
98220339,"price":25.99,"author":"Chuck Easttom"}]
-],
-[
- [ {"title":"JUnit in Action","pages":386,"isdn":93011099534534,"price":1=
9.37,"author":"Vincent Masson"},
- {"title":"Beginning C# 2008 from novice to professional","pages":511,"=
isdn":9781590598696,"price":23.56,"author":"Christian Gross"},
- {"title":"Advanced JavaScript. Third Edition","pages":617,"isdn":97815=
98220339,"price":25.99,"author":"Chuck Easttom"},
- {"title":"JUnit in Action","pages":386,"isdn":93011099534534,"price":1=
9.37,"author":"Vincent Masson"},
- {"title":"Beginning C# 2008 from novice to professional","pages":511,"=
isdn":9781590598696,"price":23.56,"author":"Christian Gross"},
- {"title":"Advanced JavaScript. Third Edition","pages":617,"isdn":97815=
98220339,"price":25.99,"author":"Chuck Easttom"}],
- [ {"title":"JUnit in Action","pages":386,"isdn":93011099534534,"price":1=
9.37,"author":"Vincent Masson"},
- {"title":"Beginning C# 2008 from novice to professional","pages":511,"=
isdn":9781590598696,"price":23.56,"author":"Christian Gross"},
- {"title":"Advanced JavaScript. Third Edition","pages":617,"isdn":97815=
98220339,"price":25.99,"author":"Chuck Easttom"},
- {"title":"JUnit in Action","pages":386,"isdn":93011099534534,"price":1=
9.37,"author":"Vincent Masson"},
- {"title":"Beginning C# 2008 from novice to professional","pages":511,"=
isdn":9781590598696,"price":23.56,"author":"Christian Gross"},
- {"title":"Advanced JavaScript. Third Edition","pages":617,"isdn":97815=
98220339,"price":25.99,"author":"Chuck Easttom"},
- {"title":"JUnit in Action","pages":386,"isdn":93011099534534,"price":1=
9.37,"author":"Vincent Masson"},
- {"title":"Beginning C# 2008 from novice to professional","pages":511,"=
isdn":9781590598696,"price":23.56,"author":"Christian Gross"},
- {"title":"Advanced JavaScript. Third Edition","pages":617,"isdn":97815=
98220339,"price":25.99,"author":"Chuck Easttom"},
- {"title":"JUnit in Action","pages":386,"isdn":93011099534534,"price":1=
9.37,"author":"Vincent Masson"},
- {"title":"Beginning C# 2008 from novice to professional","pages":511,"=
isdn":9781590598696,"price":23.56,"author":"Christian Gross"},
- {"title":"Advanced JavaScript. Third Edition","pages":617,"isdn":97815=
98220339,"price":25.99,"author":"Chuck Easttom"}]
-]
-]
-}
\ No newline at end of file
Modified: ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/=
rest/impl/provider/JsonEntityProvider.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/i=
mpl/provider/JsonEntityProvider.java 2010-10-05 11:33:24 UTC (rev 3245)
+++ ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/i=
mpl/provider/JsonEntityProvider.java 2010-10-05 14:59:07 UTC (rev 3246)
@@ -19,15 +19,14 @@
package org.exoplatform.services.rest.impl.provider;
=
import org.exoplatform.services.rest.provider.EntityProvider;
-import org.exoplatform.ws.frameworks.json.JsonHandler;
-import org.exoplatform.ws.frameworks.json.JsonParser;
-import org.exoplatform.ws.frameworks.json.JsonWriter;
-import org.exoplatform.ws.frameworks.json.impl.BeanBuilder;
import org.exoplatform.ws.frameworks.json.impl.JsonDefaultHandler;
import org.exoplatform.ws.frameworks.json.impl.JsonException;
import org.exoplatform.ws.frameworks.json.impl.JsonGeneratorImpl;
import org.exoplatform.ws.frameworks.json.impl.JsonParserImpl;
+import org.exoplatform.ws.frameworks.json.impl.JsonUtils;
import org.exoplatform.ws.frameworks.json.impl.JsonWriterImpl;
+import org.exoplatform.ws.frameworks.json.impl.ObjectBuilder;
+import org.exoplatform.ws.frameworks.json.impl.JsonUtils.Types;
import org.exoplatform.ws.frameworks.json.value.JsonValue;
=
import java.io.IOException;
@@ -35,6 +34,8 @@
import java.io.OutputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
+import java.util.Collection;
+import java.util.Map;
=
import javax.ws.rs.Consumes;
import javax.ws.rs.Produces;
@@ -71,19 +72,38 @@
/**
* {@inheritDoc}
*/
+ @SuppressWarnings("unchecked")
public Object readFrom(Class type, Type genericType, Annotation=
[] annotations, MediaType mediaType,
MultivaluedMap httpHeaders, InputStream entityStream=
) throws IOException
{
try
{
- JsonParser jsonParser =3D new JsonParserImpl();
- JsonHandler jsonHandler =3D new JsonDefaultHandler();
- jsonParser.parse(entityStream, jsonHandler);
- JsonValue jsonValue =3D jsonHandler.getJsonObject();
- // jsonValue can be null if stream empty
- if (jsonValue =3D=3D null)
- return null;
- return new BeanBuilder().createObject(type, jsonValue);
+ JsonParserImpl parser =3D new JsonParserImpl();
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+
+ parser.parse(entityStream, handler);
+ JsonValue jsonValue =3D handler.getJsonObject();
+
+ Types jtype =3D JsonUtils.getType(type);
+ if (jtype =3D=3D Types.ARRAY_BOOLEAN || jtype =3D=3D Types.ARRAY_=
BYTE || jtype =3D=3D Types.ARRAY_SHORT
+ || jtype =3D=3D Types.ARRAY_INT || jtype =3D=3D Types.ARRAY_LO=
NG || jtype =3D=3D Types.ARRAY_FLOAT
+ || jtype =3D=3D Types.ARRAY_DOUBLE || jtype =3D=3D Types.ARRAY=
_CHAR || jtype =3D=3D Types.ARRAY_STRING
+ || jtype =3D=3D Types.ARRAY_OBJECT)
+ {
+ return ObjectBuilder.createArray(type, jsonValue);
+ }
+ if (jtype =3D=3D Types.COLLECTION)
+ {
+ Class c =3D type;
+ return ObjectBuilder.createCollection(c, genericType, jsonValu=
e);
+ }
+ if (jtype =3D=3D Types.MAP)
+ {
+ Class c =3D type;
+ return ObjectBuilder.createObject(c, genericType, jsonValue);
+ }
+ return ObjectBuilder.createObject(type, jsonValue);
+
}
catch (Exception e)
{
@@ -111,14 +131,37 @@
/**
* {@inheritDoc}
*/
+ @SuppressWarnings("unchecked")
public void writeTo(Object t, Class> type, Type genericType, Annotati=
on[] annotations, MediaType mediaType,
MultivaluedMap httpHeaders, OutputStream entityStrea=
m) throws IOException
{
try
{
- JsonValue jv =3D new JsonGeneratorImpl().createJsonObject(t);
- JsonWriter jsonWriter =3D new JsonWriterImpl(entityStream);
- jv.writeTo(jsonWriter);
+ JsonGeneratorImpl generator =3D new JsonGeneratorImpl();
+ JsonValue jsonValue =3D null;
+ Types jtype =3D JsonUtils.getType(type);
+ if (jtype =3D=3D Types.ARRAY_BOOLEAN || jtype =3D=3D Types.ARRAY_=
BYTE || jtype =3D=3D Types.ARRAY_SHORT
+ || jtype =3D=3D Types.ARRAY_INT || jtype =3D=3D Types.ARRAY_LO=
NG || jtype =3D=3D Types.ARRAY_FLOAT
+ || jtype =3D=3D Types.ARRAY_DOUBLE || jtype =3D=3D Types.ARRAY=
_CHAR || jtype =3D=3D Types.ARRAY_STRING
+ || jtype =3D=3D Types.ARRAY_OBJECT)
+ {
+ jsonValue =3D generator.createJsonArray(t);
+ }
+ else if (jtype =3D=3D Types.COLLECTION)
+ {
+ jsonValue =3D generator.createJsonArray((Collection>)t);
+ }
+ else if (jtype =3D=3D Types.MAP)
+ {
+ jsonValue =3D generator.createJsonObjectFromMap((Map)t);
+ }
+ else
+ {
+ jsonValue =3D generator.createJsonObject(t);
+ }
+
+ JsonWriterImpl jsonWriter =3D new JsonWriterImpl(entityStream);
+ jsonValue.writeTo(jsonWriter);
jsonWriter.flush();
}
catch (JsonException e)
Deleted: ws/trunk/exo.ws.rest.core/src/test/java/org/exoplatform/services/r=
est/impl/provider/JsonEntityTest.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/trunk/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/i=
mpl/provider/JsonEntityTest.java 2010-10-05 11:33:24 UTC (rev 3245)
+++ ws/trunk/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/i=
mpl/provider/JsonEntityTest.java 2010-10-05 14:59:07 UTC (rev 3246)
@@ -1,132 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.rest.impl.provider;
-
-import org.exoplatform.services.rest.BaseTest;
-import org.exoplatform.services.rest.generated.Book;
-import org.exoplatform.services.rest.impl.ContainerResponse;
-import org.exoplatform.services.rest.impl.MultivaluedMapImpl;
-import org.exoplatform.services.rest.tools.ByteArrayContainerResponseWrite=
r;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MultivaluedMap;
-
-/**
- * @author Andrey Parfonov
- * @version $Id: $
- */
-public class JsonEntityTest extends BaseTest
-{
-
- @Path("/")
- public static class Resource1
- {
- @POST
- @Consumes("application/json")
- public void m1(Book book)
- {
- assertEquals("Hamlet", book.getTitle());
- assertEquals("William Shakespeare", book.getAuthor());
- assertTrue(book.isSendByPost());
- }
- }
-
- @Path("/")
- public static class Resource2
- {
- @GET
- @Produces("application/json")
- public Book m1()
- {
- Book book =3D new Book();
- book.setTitle("Hamlet");
- book.setAuthor("William Shakespeare");
- book.setSendByPost(true);
- return book;
- }
-
- // Without @Produces annotation also should work.
- @POST
- public Book m2()
- {
- Book book =3D new Book();
- book.setTitle("Hamlet\n");
- book.setAuthor("William Shakespeare\n");
- book.setSendByPost(false);
- return book;
- }
- }
-
- private byte[] jsonData;
-
- public void setUp() throws Exception
- {
- super.setUp();
- jsonData =3D
- ("{\"title\":\"Hamlet\"," + "\"author\":\"William Shakespeare\","=
+ "\"sendByPost\":true}").getBytes("UTF-8");
- }
-
- public void testJsonEntityParameter() throws Exception
- {
- Resource1 r1 =3D new Resource1();
- registry(r1);
- MultivaluedMap h =3D new MultivaluedMapImpl();
- // Object is transfered via JSON
- h.putSingle("content-type", "application/json");
- // with JSON transformation for Book have restriction can't pass Big=
Decimal
- // (has not simple constructor and it is not in JSON known types)
- h.putSingle("content-length", "" + jsonData.length);
- assertEquals(204, launcher.service("POST", "/", "", h, jsonData, nul=
l).getStatus());
- unregistry(r1);
- }
-
- public void testJsonReturn() throws Exception
- {
- Resource2 r2 =3D new Resource2();
- registry(r2);
- MultivaluedMap h =3D new MultivaluedMapImpl();
- h.putSingle("accept", "application/json");
- ByteArrayContainerResponseWriter writer =3D new ByteArrayContainerRe=
sponseWriter();
-
- // Resource2#m1()
- ContainerResponse response =3D launcher.service("GET", "/", "", h, n=
ull, writer, null);
- assertEquals(200, response.getStatus());
- assertEquals("application/json", response.getContentType().toString(=
));
- Book book =3D (Book)response.getEntity();
- assertEquals("Hamlet", book.getTitle());
- assertEquals("William Shakespeare", book.getAuthor());
- assertTrue(book.isSendByPost());
-
- // Resource2#m2()
- response =3D launcher.service("POST", "/", "", h, null, writer, null=
);
- assertEquals(200, response.getStatus());
- assertEquals("application/json", response.getContentType().toString(=
));
- book =3D (Book)response.getEntity();
- assertEquals("Hamlet\n", book.getTitle());
- assertEquals("William Shakespeare\n", book.getAuthor());
- assertFalse(book.isSendByPost());
-// writer =3D new ByteArrayContainerResponseWriter();
- unregistry(r2);
- }
-
-}
Added: ws/trunk/exo.ws.rest.core/src/test/java/org/exoplatform/services/res=
t/impl/provider/JsonEntityTest.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/trunk/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/i=
mpl/provider/JsonEntityTest.java (rev 0)
+++ ws/trunk/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/i=
mpl/provider/JsonEntityTest.java 2010-10-05 14:59:07 UTC (rev 3246)
@@ -0,0 +1,475 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.rest.impl.provider;
+
+import org.exoplatform.services.rest.BaseTest;
+import org.exoplatform.services.rest.generated.Book;
+import org.exoplatform.services.rest.impl.ContainerResponse;
+import org.exoplatform.services.rest.impl.MultivaluedMapImpl;
+import org.exoplatform.services.rest.tools.ByteArrayContainerResponseWrite=
r;
+import org.exoplatform.ws.frameworks.json.impl.JsonDefaultHandler;
+import org.exoplatform.ws.frameworks.json.impl.JsonParserImpl;
+import org.exoplatform.ws.frameworks.json.impl.ObjectBuilder;
+
+import java.io.ByteArrayInputStream;
+import java.lang.reflect.ParameterizedType;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MultivaluedMap;
+
+/**
+ * @author Andrey Parfonov
+ * @version $Id$
+ */
+public class JsonEntityTest extends BaseTest
+{
+
+ @Path("/")
+ public static class ResourceBook
+ {
+ @POST
+ @Consumes("application/json")
+ public void m1(Book book)
+ {
+ assertEquals("Hamlet", book.getTitle());
+ assertEquals("William Shakespeare", book.getAuthor());
+ assertTrue(book.isSendByPost());
+ }
+ }
+
+ @Path("/")
+ public static class ResourceBookArray
+ {
+ @POST
+ @Consumes("application/json")
+ public void m1(Book[] b)
+ {
+ assertEquals("Hamlet", b[0].getTitle());
+ assertEquals("William Shakespeare", b[0].getAuthor());
+ assertTrue(b[0].isSendByPost());
+ assertEquals("Collected Stories", b[1].getTitle());
+ assertEquals("Gabriel Garcia Marquez", b[1].getAuthor());
+ assertTrue(b[1].isSendByPost());
+ }
+ }
+
+ @Path("/")
+ public static class ResourceBookCollection
+ {
+ @POST
+ @Consumes("application/json")
+ public void m1(List b)
+ {
+ assertEquals("Hamlet", b.get(0).getTitle());
+ assertEquals("William Shakespeare", b.get(0).getAuthor());
+ assertTrue(b.get(0).isSendByPost());
+ assertEquals("Collected Stories", b.get(1).getTitle());
+ assertEquals("Gabriel Garcia Marquez", b.get(1).getAuthor());
+ assertTrue(b.get(1).isSendByPost());
+ }
+ }
+
+ @Path("/")
+ public static class ResourceBookMap
+ {
+ @POST
+ @Consumes("application/json")
+ public void m1(Map b)
+ {
+ assertEquals("Hamlet", b.get("12345").getTitle());
+ assertEquals("William Shakespeare", b.get("12345").getAuthor());
+ assertTrue(b.get("12345").isSendByPost());
+ assertEquals("Collected Stories", b.get("54321").getTitle());
+ assertEquals("Gabriel Garcia Marquez", b.get("54321").getAuthor()=
);
+ assertTrue(b.get("54321").isSendByPost());
+ }
+ }
+
+ @Path("/")
+ public static class ResourceBook2
+ {
+ @GET
+ @Produces("application/json")
+ public Book m1()
+ {
+ Book book =3D new Book();
+ book.setTitle("Hamlet");
+ book.setAuthor("William Shakespeare");
+ book.setSendByPost(true);
+ return book;
+ }
+
+ // Without @Produces annotation also should work.
+ @POST
+ public Book m2()
+ {
+ return m1();
+ }
+ }
+
+ @Path("/")
+ public static class ResourceBookArray2
+ {
+ @GET
+ @Produces("application/json")
+ public Book[] m1()
+ {
+ return createArray();
+ }
+
+ // Without @Produces annotation also should work.
+ @POST
+ public Book[] m2()
+ {
+ return createArray();
+ }
+
+ private Book[] createArray()
+ {
+ Book book1 =3D new Book();
+ book1.setTitle("Hamlet");
+ book1.setAuthor("William Shakespeare");
+ book1.setSendByPost(true);
+ Book book2 =3D new Book();
+ book2.setTitle("Collected Stories");
+ book2.setAuthor("Gabriel Garcia Marquez");
+ book2.setSendByPost(true);
+ return new Book[]{book1, book2};
+ }
+ }
+
+ @Path("/")
+ public static class ResourceBookCollection2
+ {
+ @GET
+ @Produces("application/json")
+ public List m1()
+ {
+ return createCollection();
+ }
+
+ // Without @Produces annotation also should work.
+ @POST
+ public List m2()
+ {
+ return createCollection();
+ }
+
+ private List createCollection()
+ {
+ Book book1 =3D new Book();
+ book1.setTitle("Hamlet");
+ book1.setAuthor("William Shakespeare");
+ book1.setSendByPost(true);
+ Book book2 =3D new Book();
+ book2.setTitle("Collected Stories");
+ book2.setAuthor("Gabriel Garcia Marquez");
+ book2.setSendByPost(true);
+ return Arrays.asList(book1, book2);
+ }
+ }
+
+ @Path("/")
+ public static class ResourceBookMap2
+ {
+ @GET
+ @Produces("application/json")
+ public Map m1()
+ {
+ return createMap();
+ }
+
+ // Without @Produces annotation also should work.
+ @POST
+ public Map m2()
+ {
+ return createMap();
+ }
+
+ private Map createMap()
+ {
+ Book book1 =3D new Book();
+ book1.setTitle("Hamlet");
+ book1.setAuthor("William Shakespeare");
+ book1.setSendByPost(true);
+ Book book2 =3D new Book();
+ book2.setTitle("Collected Stories");
+ book2.setAuthor("Gabriel Garcia Marquez");
+ book2.setSendByPost(true);
+ Map m =3D new HashMap();
+ m.put("12345", book1);
+ m.put("54321", book2);
+ return m;
+ }
+ }
+
+ private byte[] jsonBookData;
+
+ private byte[] jsonArrayData;
+
+ private byte[] jsonMapData;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ jsonBookData =3D
+ ("{\"title\":\"Hamlet\", \"author\":\"William Shakespeare\", \"se=
ndByPost\":true}").getBytes("UTF-8");
+ jsonArrayData =3D
+ ("[{\"title\":\"Hamlet\", \"author\":\"William Shakespeare\", \"s=
endByPost\":true},"
+ + "{\"title\":\"Collected Stories\", \"author\":\"Gabriel Garc=
ia Marquez\", \"sendByPost\":true}]")
+ .getBytes("UTF-8");
+ jsonMapData =3D
+ ("{\"12345\":{\"title\":\"Hamlet\", \"author\":\"William Shakespe=
are\", \"sendByPost\":true},"
+ + "\"54321\":{\"title\":\"Collected Stories\", \"author\":\"Ga=
briel Garcia Marquez\", \"sendByPost\":true}}")
+ .getBytes("UTF-8");
+ }
+
+ public void testJsonEntityBean() throws Exception
+ {
+ ResourceBook r1 =3D new ResourceBook();
+ registry(r1);
+ MultivaluedMap h =3D new MultivaluedMapImpl();
+ // Object is transfered via JSON
+ h.putSingle("content-type", "application/json");
+ // with JSON transformation for Book have restriction can't pass Big=
Decimal
+ // (has not simple constructor and it is not in JSON known types)
+ h.putSingle("content-length", "" + jsonBookData.length);
+ assertEquals(204, launcher.service("POST", "/", "", h, jsonBookData,=
null).getStatus());
+ unregistry(r1);
+ }
+
+ public void testJsonEntityArray() throws Exception
+ {
+ ResourceBookArray r1 =3D new ResourceBookArray();
+ registry(r1);
+ MultivaluedMap h =3D new MultivaluedMapImpl();
+ // Object is transfered via JSON
+ h.putSingle("content-type", "application/json");
+ h.putSingle("content-length", "" + jsonArrayData.length);
+ assertEquals(204, launcher.service("POST", "/", "", h, jsonArrayData=
, null).getStatus());
+ unregistry(r1);
+ }
+
+ public void testJsonEntityCollection() throws Exception
+ {
+ ResourceBookCollection r1 =3D new ResourceBookCollection();
+ registry(r1);
+ MultivaluedMap h =3D new MultivaluedMapImpl();
+ // Object is transfered via JSON
+ h.putSingle("content-type", "application/json");
+ h.putSingle("content-length", "" + jsonArrayData.length);
+ assertEquals(204, launcher.service("POST", "/", "", h, jsonArrayData=
, null).getStatus());
+ unregistry(r1);
+ }
+
+ public void testJsonEntityMap() throws Exception
+ {
+ ResourceBookMap r1 =3D new ResourceBookMap();
+ registry(r1);
+ MultivaluedMap h =3D new MultivaluedMapImpl();
+ // Object is transfered via JSON
+ h.putSingle("content-type", "application/json");
+ h.putSingle("content-length", "" + jsonMapData.length);
+ assertEquals(204, launcher.service("POST", "/", "", h, jsonMapData, =
null).getStatus());
+ unregistry(r1);
+ }
+
+ public void testJsonReturnBean() throws Exception
+ {
+ ResourceBook2 r2 =3D new ResourceBook2();
+ registry(r2);
+ MultivaluedMap h =3D new MultivaluedMapImpl();
+ h.putSingle("accept", "application/json");
+ ByteArrayContainerResponseWriter writer =3D new ByteArrayContainerRe=
sponseWriter();
+
+ // ResourceBook2#m1()
+ ContainerResponse response =3D launcher.service("GET", "/", "", h, n=
ull, writer, null);
+ assertEquals(200, response.getStatus());
+ assertEquals("application/json", response.getContentType().toString(=
));
+ JsonParserImpl parser =3D new JsonParserImpl();
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+ parser.parse(new ByteArrayInputStream(writer.getBody()), handler);
+ Book book =3D ObjectBuilder.createObject(Book.class, handler.getJson=
Object());
+ assertEquals("Hamlet", book.getTitle());
+ assertEquals("William Shakespeare", book.getAuthor());
+ assertTrue(book.isSendByPost());
+
+ // ResourceBook2#m2()
+ writer.reset();
+ handler.reset();
+ response =3D launcher.service("POST", "/", "", h, null, writer, null=
);
+ assertEquals(200, response.getStatus());
+ assertEquals("application/json", response.getContentType().toString(=
));
+ parser.parse(new ByteArrayInputStream(writer.getBody()), handler);
+ book =3D ObjectBuilder.createObject(Book.class, handler.getJsonObjec=
t());
+ assertEquals("Hamlet", book.getTitle());
+ assertEquals("William Shakespeare", book.getAuthor());
+ assertTrue(book.isSendByPost());
+
+ unregistry(r2);
+ }
+
+ public void testJsonReturnBeanArray() throws Exception
+ {
+ ResourceBookArray2 r2 =3D new ResourceBookArray2();
+ registry(r2);
+ MultivaluedMap h =3D new MultivaluedMapImpl();
+ h.putSingle("accept", "application/json");
+ ByteArrayContainerResponseWriter writer =3D new ByteArrayContainerRe=
sponseWriter();
+
+ // ResourceBookArray2#m1()
+ ContainerResponse response =3D launcher.service("GET", "/", "", h, n=
ull, writer, null);
+ assertEquals(200, response.getStatus());
+ assertEquals("application/json", response.getContentType().toString(=
));
+ JsonParserImpl parser =3D new JsonParserImpl();
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+ parser.parse(new ByteArrayInputStream(writer.getBody()), handler);
+ Book[] book =3D (Book[])ObjectBuilder.createArray(new Book[0].getCla=
ss(), handler.getJsonObject());
+ assertEquals("Hamlet", book[0].getTitle());
+ assertEquals("William Shakespeare", book[0].getAuthor());
+ assertTrue(book[0].isSendByPost());
+ assertEquals("Collected Stories", book[1].getTitle());
+ assertEquals("Gabriel Garcia Marquez", book[1].getAuthor());
+ assertTrue(book[1].isSendByPost());
+ //System.out.println("array: " + new String(writer.getBody()));
+
+ // ResourceBookArray2#m2()
+ writer.reset();
+ handler.reset();
+ response =3D launcher.service("POST", "/", "", h, null, writer, null=
);
+ assertEquals(200, response.getStatus());
+ assertEquals("application/json", response.getContentType().toString(=
));
+ parser.parse(new ByteArrayInputStream(writer.getBody()), handler);
+ book =3D (Book[])ObjectBuilder.createArray(new Book[0].getClass(), h=
andler.getJsonObject());
+ assertEquals("Hamlet", book[0].getTitle());
+ assertEquals("William Shakespeare", book[0].getAuthor());
+ assertTrue(book[0].isSendByPost());
+ assertEquals("Collected Stories", book[1].getTitle());
+ assertEquals("Gabriel Garcia Marquez", book[1].getAuthor());
+ assertTrue(book[1].isSendByPost());
+ //System.out.println("array: " + new String(writer.getBody()));
+
+ unregistry(r2);
+ }
+
+ @SuppressWarnings({"unchecked", "serial"})
+ public void testJsonReturnBeanCollection() throws Exception
+ {
+ ResourceBookCollection2 r2 =3D new ResourceBookCollection2();
+ registry(r2);
+ MultivaluedMap h =3D new MultivaluedMapImpl();
+ h.putSingle("accept", "application/json");
+ ByteArrayContainerResponseWriter writer =3D new ByteArrayContainerRe=
sponseWriter();
+
+ // ResourceBookCollection2#m1()
+ ContainerResponse response =3D launcher.service("GET", "/", "", h, n=
ull, writer, null);
+ assertEquals(200, response.getStatus());
+ assertEquals("application/json", response.getContentType().toString(=
));
+ JsonParserImpl parser =3D new JsonParserImpl();
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+ parser.parse(new ByteArrayInputStream(writer.getBody()), handler);
+ ParameterizedType genericType =3D (ParameterizedType)new ArrayList()
+ {
+ }.getClass().getGenericSuperclass();
+ //System.out.println(">>>>>"+genericType);
+ List book =3D ObjectBuilder.createCollection(List.class, gener=
icType, handler.getJsonObject());
+ assertEquals("Hamlet", book.get(0).getTitle());
+ assertEquals("William Shakespeare", book.get(0).getAuthor());
+ assertTrue(book.get(0).isSendByPost());
+ assertEquals("Collected Stories", book.get(1).getTitle());
+ assertEquals("Gabriel Garcia Marquez", book.get(1).getAuthor());
+ assertTrue(book.get(1).isSendByPost());
+ //System.out.println("collection: " + new String(writer.getBody()));
+
+ // ResourceBookCollection2#m2()
+ writer.reset();
+ handler.reset();
+ response =3D launcher.service("POST", "/", "", h, null, writer, null=
);
+ assertEquals(200, response.getStatus());
+ assertEquals("application/json", response.getContentType().toString(=
));
+ parser.parse(new ByteArrayInputStream(writer.getBody()), handler);
+ book =3D ObjectBuilder.createCollection(List.class, genericType, han=
dler.getJsonObject());
+ assertEquals("Hamlet", book.get(0).getTitle());
+ assertEquals("William Shakespeare", book.get(0).getAuthor());
+ assertTrue(book.get(0).isSendByPost());
+ assertEquals("Collected Stories", book.get(1).getTitle());
+ assertEquals("Gabriel Garcia Marquez", book.get(1).getAuthor());
+ assertTrue(book.get(1).isSendByPost());
+ //System.out.println("collection: " + new String(writer.getBody()));
+
+ unregistry(r2);
+ }
+
+ @SuppressWarnings({"unchecked", "serial"})
+ public void testJsonReturnBeanMap() throws Exception
+ {
+ ResourceBookMap2 r2 =3D new ResourceBookMap2();
+ registry(r2);
+ MultivaluedMap h =3D new MultivaluedMapImpl();
+ h.putSingle("accept", "application/json");
+ ByteArrayContainerResponseWriter writer =3D new ByteArrayContainerRe=
sponseWriter();
+
+ // ResourceBookMap2#m1()
+ ContainerResponse response =3D launcher.service("GET", "/", "", h, n=
ull, writer, null);
+ assertEquals(200, response.getStatus());
+ assertEquals("application/json", response.getContentType().toString(=
));
+ JsonParserImpl parser =3D new JsonParserImpl();
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+ parser.parse(new ByteArrayInputStream(writer.getBody()), handler);
+ ParameterizedType genericType =3D (ParameterizedType)new HashMap()
+ {
+ }.getClass().getGenericSuperclass();
+ //System.out.println(">>>>>" + genericType);
+ Map book =3D ObjectBuilder.createObject(Map.class, gen=
ericType, handler.getJsonObject());
+ assertEquals("Hamlet", book.get("12345").getTitle());
+ assertEquals("William Shakespeare", book.get("12345").getAuthor());
+ assertTrue(book.get("12345").isSendByPost());
+ assertEquals("Collected Stories", book.get("54321").getTitle());
+ assertEquals("Gabriel Garcia Marquez", book.get("54321").getAuthor()=
);
+ assertTrue(book.get("54321").isSendByPost());
+ //System.out.println("map: " + new String(writer.getBody()));
+
+ // ResourceBookMap2#m2()
+ writer.reset();
+ handler.reset();
+ response =3D launcher.service("POST", "/", "", h, null, writer, null=
);
+ assertEquals(200, response.getStatus());
+ assertEquals("application/json", response.getContentType().toString(=
));
+ parser.parse(new ByteArrayInputStream(writer.getBody()), handler);
+ book =3D ObjectBuilder.createObject(Map.class, genericType, handler.=
getJsonObject());
+ assertEquals("Hamlet", book.get("12345").getTitle());
+ assertEquals("William Shakespeare", book.get("12345").getAuthor());
+ assertTrue(book.get("12345").isSendByPost());
+ assertEquals("Collected Stories", book.get("54321").getTitle());
+ assertEquals("Gabriel Garcia Marquez", book.get("54321").getAuthor()=
);
+ assertTrue(book.get("54321").isSendByPost());
+ //System.out.println("map: " + new String(writer.getBody()));
+
+ unregistry(r2);
+ }
+}
Property changes on: ws/trunk/exo.ws.rest.core/src/test/java/org/exoplatfor=
m/services/rest/impl/provider/JsonEntityTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
--===============0938029445778835888==--
From do-not-reply at jboss.org Wed Oct 6 03:47:53 2010
Content-Type: multipart/mixed; boundary="===============7878168683436356757=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3249 - in
jcr/trunk/exo.jcr.component.ext/src:
main/java/org/exoplatform/services/jcr/ext/backup/impl and 1 other
directories.
Date: Wed, 06 Oct 2010 03:47:53 -0400
Message-ID: <201010060747.o967lrmu027952@svn01.web.mwc.hst.phx2.redhat.com>
--===============7878168683436356757==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: areshetnyak
Date: 2010-10-06 03:47:53 -0400 (Wed, 06 Oct 2010)
New Revision: 3249
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/j=
cr/ext/backup/ExtendedBackupManager.java
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/j=
cr/ext/backup/impl/BackupManagerImpl.java
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/j=
cr/ext/backup/TestBackupManager.java
Log:
EXOJCR-747 : Make backup restore easier implementation.
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/ser=
vices/jcr/ext/backup/ExtendedBackupManager.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/=
jcr/ext/backup/ExtendedBackupManager.java 2010-10-06 06:56:19 UTC (rev 3248)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/=
jcr/ext/backup/ExtendedBackupManager.java 2010-10-06 07:47:53 UTC (rev 3249)
@@ -30,7 +30,7 @@
public interface ExtendedBackupManager extends BackupManager
{
/**
- * Restore existed workspace. Previous data will be deleted.
+ * Restore existing workspace. Previous data will be deleted.
* For getting status of workspace restore can use =
* BackupManager.getLastRestore(String repositoryName, String workspace=
Name) method =
* =
@@ -45,11 +45,11 @@
* @throws BackupConfigurationException
* if configuration exception occurred
*/
- void restoreExistedWorkspace(String workspaceBackupIdentifier, String r=
epositoryName, WorkspaceEntry workspaceEntry,
+ void restoreExistingWorkspace(String workspaceBackupIdentifier, String =
repositoryName, WorkspaceEntry workspaceEntry,
boolean asynchronous) throws BackupOperationException, BackupConfigu=
rationException;
=
/**
- * Restore existed workspace. Previous data will be deleted.
+ * Restore existing workspace. Previous data will be deleted.
* For getting status of workspace restore can use =
* BackupManager.getLastRestore(String repositoryName, String workspace=
Name) method =
* =
@@ -64,10 +64,10 @@
* @throws BackupConfigurationException
* if configuration exception occurred
*/
- void restoreExistedWorkspace(BackupChainLog log, String repositoryName,=
WorkspaceEntry workspaceEntry, boolean asynchronous) throws BackupOperati=
onException, BackupConfigurationException;
+ void restoreExistingWorkspace(BackupChainLog log, String repositoryName=
, WorkspaceEntry workspaceEntry, boolean asynchronous) throws BackupOperat=
ionException, BackupConfigurationException;
=
/**
- * Restore existed repository. Previous data will be deleted.
+ * Restore existing repository. Previous data will be deleted.
* For getting status of repository restore can use =
* BackupManager.getLastRestore(String repositoryName) method =
* =
@@ -82,10 +82,10 @@
* @throws BackupConfigurationException
* if configuration exception occurred
*/
- void restoreExistedRepository(String repositoryBackupIdentifier, Repos=
itoryEntry repositoryEntry, boolean asynchronous) throws BackupOperationEx=
ception, BackupConfigurationException;
+ void restoreExistingRepository(String repositoryBackupIdentifier, Repo=
sitoryEntry repositoryEntry, boolean asynchronous) throws BackupOperationE=
xception, BackupConfigurationException;
=
/**
- * Restore existed repository. Previous data will be deleted.
+ * Restore existing repository. Previous data will be deleted.
* For getting status of repository restore can use =
* BackupManager.getLastRestore(String repositoryName) method =
* =
@@ -100,7 +100,7 @@
* @throws BackupConfigurationException
* if configuration exception occurred
*/
- void restoreExistedRepository(RepositoryBackupChainLog log, RepositoryE=
ntry repositoryEntry, boolean asynchronous)
+ void restoreExistingRepository(RepositoryBackupChainLog log, Repository=
Entry repositoryEntry, boolean asynchronous)
throws BackupOperationException, BackupConfigurationException;
=
}
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/ser=
vices/jcr/ext/backup/impl/BackupManagerImpl.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/=
jcr/ext/backup/impl/BackupManagerImpl.java 2010-10-06 06:56:19 UTC (rev 324=
8)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/=
jcr/ext/backup/impl/BackupManagerImpl.java 2010-10-06 07:47:53 UTC (rev 324=
9)
@@ -1610,7 +1610,7 @@
/**
* {@inheritDoc}
*/
- public void restoreExistedRepository(RepositoryBackupChainLog rblog, Re=
positoryEntry repositoryEntry,
+ public void restoreExistingRepository(RepositoryBackupChainLog rblog, R=
epositoryEntry repositoryEntry,
boolean asynchronous) throws BackupOperationException, BackupC=
onfigurationException
{
try
@@ -1682,7 +1682,7 @@
/**
* {@inheritDoc}
*/
- public void restoreExistedRepository(String repositoryBackupIdentifier,=
RepositoryEntry repositoryEntry,
+ public void restoreExistingRepository(String repositoryBackupIdentifier=
, RepositoryEntry repositoryEntry,
boolean asynchronous) throws BackupOperationException, BackupC=
onfigurationException
{
RepositoryBackupChainLog backupChainLog =3D null;
@@ -1701,13 +1701,13 @@
throw new BackupConfigurationException("Can not founf backup of r=
epository with id \"" + repositoryBackupIdentifier + "\"");
}
=
- this.restoreExistedRepository(backupChainLog, repositoryEntry, async=
hronous);
+ this.restoreExistingRepository(backupChainLog, repositoryEntry, asyn=
chronous);
}
=
/**
* {@inheritDoc}
*/
- public void restoreExistedWorkspace(BackupChainLog log, String reposito=
ryName, WorkspaceEntry workspaceEntry,
+ public void restoreExistingWorkspace(BackupChainLog log, String reposit=
oryName, WorkspaceEntry workspaceEntry,
boolean asynchronous) throws BackupOperationException, BackupC=
onfigurationException
{
try =
@@ -1748,7 +1748,7 @@
/**
* {@inheritDoc}
*/
- public void restoreExistedWorkspace(String workspaceBackupIdentifier, S=
tring repositoryName,
+ public void restoreExistingWorkspace(String workspaceBackupIdentifier, =
String repositoryName,
WorkspaceEntry workspaceEntry, boolean asynchronous) throws Ba=
ckupOperationException,
BackupConfigurationException
{
@@ -1768,7 +1768,7 @@
throw new BackupConfigurationException("Can not founf backup of w=
orkspace with id \"" + workspaceBackupIdentifier + "\"");
}
=
- this.restoreExistedWorkspace(backupChainLog, repositoryName, workspa=
ceEntry, asynchronous);
+ this.restoreExistingWorkspace(backupChainLog, repositoryName, worksp=
aceEntry, asynchronous);
}
=
}
Modified: jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/ser=
vices/jcr/ext/backup/TestBackupManager.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/=
jcr/ext/backup/TestBackupManager.java 2010-10-06 06:56:19 UTC (rev 3248)
+++ jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/=
jcr/ext/backup/TestBackupManager.java 2010-10-06 07:47:53 UTC (rev 3249)
@@ -1279,7 +1279,7 @@
assertNotNull(bchLog.getStartedTime());
assertNotNull(bchLog.getFinishedTime());
=
- backup.restoreExistedWorkspace(bchLog, re.getName(), ws1, false);
+ backup.restoreExistingWorkspace(bchLog, re.getName(), ws1, false);
=
// check
SessionImpl back1 =3D null;
@@ -1356,7 +1356,7 @@
assertNotNull(bchLog.getStartedTime());
assertNotNull(bchLog.getFinishedTime());
=
- backup.restoreExistedWorkspace(bchLog, re.getName(), ws1, true);
+ backup.restoreExistingWorkspace(bchLog, re.getName(), ws1, true);
=
while (backup.getLastRestore(repository.getName(), ws1.getName())=
.getStateRestore() !=3D JobWorkspaceRestore.RESTORE_SUCCESSFUL
&& backup.getLastRestore(repository.getName(), ws1.getName()).=
getStateRestore() !=3D JobWorkspaceRestore.RESTORE_FAIL)
@@ -1439,7 +1439,7 @@
assertNotNull(bchLog.getStartedTime());
assertNotNull(bchLog.getFinishedTime());
=
- backup.restoreExistedWorkspace(bchLog.getBackupId(), re.getName()=
, ws1, true);
+ backup.restoreExistingWorkspace(bchLog.getBackupId(), re.getName(=
), ws1, true);
=
while (backup.getLastRestore(repository.getName(), ws1.getName())=
.getStateRestore() !=3D JobWorkspaceRestore.RESTORE_SUCCESSFUL
&& backup.getLastRestore(repository.getName(), ws1.getName()).=
getStateRestore() !=3D JobWorkspaceRestore.RESTORE_FAIL)
@@ -1511,7 +1511,7 @@
assertNotNull(bchLog.getStartedTime());
assertNotNull(bchLog.getFinishedTime());
=
- backup.restoreExistedRepository(bchLog, re, false);
+ backup.restoreExistingRepository(bchLog, re, false);
=
assertEquals(JobWorkspaceRestore.RESTORE_SUCCESSFUL, backup.getLa=
stRepositoryRestore(re.getName())
.getStateRestore());
@@ -1599,7 +1599,7 @@
assertNotNull(bchLog.getStartedTime());
assertNotNull(bchLog.getFinishedTime());
=
- backup.restoreExistedRepository(bchLog, re, false);
+ backup.restoreExistingRepository(bchLog, re, false);
=
assertEquals(JobWorkspaceRestore.RESTORE_SUCCESSFUL, backup.getLa=
stRepositoryRestore(re.getName())
.getStateRestore());
@@ -1673,7 +1673,7 @@
assertNotNull(bchLog.getStartedTime());
assertNotNull(bchLog.getFinishedTime());
=
- backup.restoreExistedRepository(bchLog, re, true);
+ backup.restoreExistingRepository(bchLog, re, true);
=
JobRepositoryRestore job =3D backup.getLastRepositoryRestore(re.g=
etName());
=
@@ -1755,7 +1755,7 @@
assertNotNull(bchLog.getStartedTime());
assertNotNull(bchLog.getFinishedTime());
=
- backup.restoreExistedRepository(bchLog.getBackupId(), re, true);
+ backup.restoreExistingRepository(bchLog.getBackupId(), re, true);
=
JobRepositoryRestore job =3D backup.getLastRepositoryRestore(re.g=
etName());
=
@@ -1857,7 +1857,7 @@
assertNotNull(bchLog.getStartedTime());
assertNotNull(bchLog.getFinishedTime());
=
- backup.restoreExistedWorkspace(bchLog, re.getName(), ws1, false);
+ backup.restoreExistingWorkspace(bchLog, re.getName(), ws1, false);
=
// check
SessionImpl back1 =3D null;
--===============7878168683436356757==--
From do-not-reply at jboss.org Wed Oct 6 03:48:31 2010
Content-Type: multipart/mixed; boundary="===============2361097509389551717=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3250 -
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup.
Date: Wed, 06 Oct 2010 03:48:31 -0400
Message-ID: <201010060748.o967mVWS027965@svn01.web.mwc.hst.phx2.redhat.com>
--===============2361097509389551717==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: areshetnyak
Date: 2010-10-06 03:48:31 -0400 (Wed, 06 Oct 2010)
New Revision: 3250
Modified:
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/=
modules/jcr/backup/exojcr-backup-service.xml
Log:
EXOJCR-747 : Make backup restore easier documentation.
Modified: jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook=
/en-US/modules/jcr/backup/exojcr-backup-service.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US=
/modules/jcr/backup/exojcr-backup-service.xml 2010-10-06 07:47:53 UTC (rev =
3249)
+++ jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US=
/modules/jcr/backup/exojcr-backup-service.xml 2010-10-06 07:48:31 UTC (rev =
3250)
@@ -483,17 +483,12 @@
Restore existing workspace or repository
=
-
- Restoring of existing workspace or repository available from J=
CR
- 1.14.0-CR1.
-
+ The resore of existing workspace or repositry is avaleble.
=
- The resore of existed workspace or repositry is avaleble.
-
For restore will be used spacial methods:
=
/**
- * Restore existed workspace. Previous data will be deleted.
+ * Restore existing workspace. Previous data will be deleted.
* For getting status of workspace restore can use =
* BackupManager.getLastRestore(String repositoryName, String workspace=
Name) method =
* =
@@ -508,11 +503,11 @@
* @throws BackupConfigurationException
* if configuration exception occurred
*/
- void restoreExistedWorkspace(String workspaceBackupIdentifier, String r=
epositoryName, WorkspaceEntry workspaceEntry,
+ void restoreExistingWorkspace(String workspaceBackupIdentifier, String =
repositoryName, WorkspaceEntry workspaceEntry,
boolean asynchronous) throws BackupOperationException, BackupConfigu=
rationException;
=
/**
- * Restore existed workspace. Previous data will be deleted.
+ * Restore existing workspace. Previous data will be deleted.
* For getting status of workspace restore use can use =
* BackupManager.getLastRestore(String repositoryName, String workspace=
Name) method =
* =
@@ -527,10 +522,10 @@
* @throws BackupConfigurationException
* if configuration exception occurred
*/
- void restoreExistedWorkspace(BackupChainLog log, String repositoryName,=
WorkspaceEntry workspaceEntry, boolean asynchronous) throws BackupOperati=
onException, BackupConfigurationException;
+ void restoreExistingWorkspace(BackupChainLog log, String repositoryName=
, WorkspaceEntry workspaceEntry, boolean asynchronous) throws BackupOperat=
ionException, BackupConfigurationException;
=
/**
- * Restore existed repository. Previous data will be deleted.
+ * Restore existing repository. Previous data will be deleted.
* For getting status of repository restore can use =
* BackupManager.getLastRestore(String repositoryName) method =
* =
@@ -545,10 +540,10 @@
* @throws BackupConfigurationException
* if configuration exception occurred
*/
- void restoreExistedRepository(String repositoryBackupIdentifier, Repos=
itoryEntry repositoryEntry, boolean asynchronous) throws BackupOperationEx=
ception, BackupConfigurationException;
+ void restoreExistingRepository(String repositoryBackupIdentifier, Repo=
sitoryEntry repositoryEntry, boolean asynchronous) throws BackupOperationE=
xception, BackupConfigurationException;
=
/**
- * Restore existed repository. Previous data will be deleted.
+ * Restore existing repository. Previous data will be deleted.
* For getting status of repository restore can use =
* BackupManager.getLastRestore(String repositoryName) method =
* =
@@ -563,7 +558,7 @@
* @throws BackupConfigurationException
* if configuration exception occurred
*/
- void restoreExistedRepository(RepositoryBackupChainLog log, RepositoryE=
ntry repositoryEntry, boolean asynchronous)
+ void restoreExistingRepository(RepositoryBackupChainLog log, Repository=
Entry repositoryEntry, boolean asynchronous)
throws BackupOperationException, BackupConfigurationException;
=
These methods for restore will do:
--===============2361097509389551717==--
From do-not-reply at jboss.org Wed Oct 6 05:31:30 2010
Content-Type: multipart/mixed; boundary="===============4544228671371904538=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3251 - in ws/trunk:
exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/provider
and 1 other directories.
Date: Wed, 06 Oct 2010 05:31:30 -0400
Message-ID: <201010060931.o969VUvd012189@svn01.web.mwc.hst.phx2.redhat.com>
--===============4544228671371904538==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: aparfonov
Date: 2010-10-06 05:31:29 -0400 (Wed, 06 Oct 2010)
New Revision: 3251
Modified:
ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/framewo=
rks/json/impl/JsonGeneratorImpl.java
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/im=
pl/provider/JsonEntityProvider.java
ws/trunk/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/im=
pl/provider/JsonEntityTest.java
Log:
EXOJCR-992
Modified: ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/=
frameworks/json/impl/JsonGeneratorImpl.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/framew=
orks/json/impl/JsonGeneratorImpl.java 2010-10-06 07:48:31 UTC (rev 3250)
+++ ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/framew=
orks/json/impl/JsonGeneratorImpl.java 2010-10-06 09:31:29 UTC (rev 3251)
@@ -29,6 +29,7 @@
import org.exoplatform.ws.frameworks.json.value.impl.ObjectValue;
import org.exoplatform.ws.frameworks.json.value.impl.StringValue;
=
+import java.io.StringReader;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
@@ -114,6 +115,22 @@
}
=
/**
+ * Create JSON object from specified string imply it is JSON object in =
String
+ * format.
+ *
+ * @param s source string
+ * @return JSON representation of map
+ * @throws JsonException if map can't be transformed in JSON representa=
tion
+ */
+ public JsonValue createJsonObjectFromString(String s) throws JsonExcept=
ion
+ {
+ JsonParserImpl parser =3D new JsonParserImpl();
+ JsonDefaultHandler handler =3D new JsonDefaultHandler();
+ parser.parse(new StringReader(s), handler);
+ return handler.getJsonObject();
+ }
+
+ /**
* Create JSON object from specified object. Object must be conform wit=
h java
* bean structure.
*
Modified: ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/=
rest/impl/provider/JsonEntityProvider.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/i=
mpl/provider/JsonEntityProvider.java 2010-10-06 07:48:31 UTC (rev 3250)
+++ ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/i=
mpl/provider/JsonEntityProvider.java 2010-10-06 09:31:29 UTC (rev 3251)
@@ -29,19 +29,27 @@
import org.exoplatform.ws.frameworks.json.impl.JsonUtils.Types;
import org.exoplatform.ws.frameworks.json.value.JsonValue;
=
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.io.Reader;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.Collection;
import java.util.Map;
=
+import javax.activation.DataSource;
import javax.ws.rs.Consumes;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.StreamingOutput;
import javax.ws.rs.ext.Provider;
+import javax.xml.bind.JAXBElement;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
=
/**
* @author Andrey Parfonov
@@ -60,13 +68,30 @@
// Or probably enough check only content type 'application/json'
// and if this content type set trust it and try parse/write
=
+ /** Do not process via JSON "known" JAX-RS types. */
+ private static final Class>[] IGNORED =3D
+ new Class>[]{byte[].class, DataSource.class, DOMSource.class, File=
.class, InputStream.class, JAXBElement.class,
+ MultivaluedMap.class, Reader.class, SAXSource.class, StreamingOut=
put.class, StreamSource.class, String.class};
+
+ private static boolean isIgnored(Class> type)
+ {
+ for (Class> c : IGNORED)
+ {
+ if (c.isAssignableFrom(type))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
/**
* {@inheritDoc}
*/
public boolean isReadable(Class> type, Type genericType, Annotation[]=
annotations, MediaType mediaType)
{
- // say as support all objects, see _TODO_ above
- return Object.class.isAssignableFrom(type);
+ // return Object.class.isAssignableFrom(type);
+ return !isIgnored(type);
}
=
/**
@@ -124,8 +149,8 @@
*/
public boolean isWriteable(Class> type, Type genericType, Annotation[=
] annotations, MediaType mediaType)
{
- // say as support all objects, see _TODO_ above
- return Object.class.isAssignableFrom(type);
+ // return Object.class.isAssignableFrom(type);
+ return !isIgnored(type);
}
=
/**
Modified: ws/trunk/exo.ws.rest.core/src/test/java/org/exoplatform/services/=
rest/impl/provider/JsonEntityTest.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/trunk/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/i=
mpl/provider/JsonEntityTest.java 2010-10-06 07:48:31 UTC (rev 3250)
+++ ws/trunk/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/i=
mpl/provider/JsonEntityTest.java 2010-10-06 09:31:29 UTC (rev 3251)
@@ -40,7 +40,9 @@
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
=
/**
* @author Andrey Parfonov
@@ -111,6 +113,17 @@
}
=
@Path("/")
+ public static class ResourceString
+ {
+ @POST
+ @Consumes("application/json")
+ public void m1(String b)
+ {
+ assertEquals(jsonBook, b);
+ }
+ }
+
+ @Path("/")
public static class ResourceBook2
{
@GET
@@ -228,6 +241,33 @@
}
}
=
+ @Path("/")
+ public static class ResourceString2
+ {
+ @GET
+ @Produces("application/json")
+ public String m1()
+ {
+ return jsonBook;
+ }
+
+ @POST
+ public Response m2()
+ {
+ return Response.ok(jsonBook).type(MediaType.APPLICATION_JSON).bui=
ld();
+ }
+ }
+
+ private static String jsonBook =3D "{\"title\":\"Hamlet\", \"author\":\=
"William Shakespeare\", \"sendByPost\":true}";
+
+ private static String jsonArray =3D
+ "[{\"title\":\"Hamlet\", \"author\":\"William Shakespeare\", \"sendB=
yPost\":true},"
+ + "{\"title\":\"Collected Stories\", \"author\":\"Gabriel Garcia =
Marquez\", \"sendByPost\":true}]";
+
+ private static String jsonMap =3D
+ "{\"12345\":{\"title\":\"Hamlet\", \"author\":\"William Shakespeare\=
", \"sendByPost\":true},"
+ + "\"54321\":{\"title\":\"Collected Stories\", \"author\":\"Gabri=
el Garcia Marquez\", \"sendByPost\":true}}";
+
private byte[] jsonBookData;
=
private byte[] jsonArrayData;
@@ -237,16 +277,9 @@
public void setUp() throws Exception
{
super.setUp();
- jsonBookData =3D
- ("{\"title\":\"Hamlet\", \"author\":\"William Shakespeare\", \"se=
ndByPost\":true}").getBytes("UTF-8");
- jsonArrayData =3D
- ("[{\"title\":\"Hamlet\", \"author\":\"William Shakespeare\", \"s=
endByPost\":true},"
- + "{\"title\":\"Collected Stories\", \"author\":\"Gabriel Garc=
ia Marquez\", \"sendByPost\":true}]")
- .getBytes("UTF-8");
- jsonMapData =3D
- ("{\"12345\":{\"title\":\"Hamlet\", \"author\":\"William Shakespe=
are\", \"sendByPost\":true},"
- + "\"54321\":{\"title\":\"Collected Stories\", \"author\":\"Ga=
briel Garcia Marquez\", \"sendByPost\":true}}")
- .getBytes("UTF-8");
+ jsonBookData =3D jsonBook.getBytes("UTF-8");
+ jsonArrayData =3D jsonArray.getBytes("UTF-8");
+ jsonMapData =3D jsonMap.getBytes("UTF-8");
}
=
public void testJsonEntityBean() throws Exception
@@ -299,6 +332,17 @@
unregistry(r1);
}
=
+ public void testJsonEntityString() throws Exception
+ {
+ ResourceString r1 =3D new ResourceString();
+ registry(r1);
+ MultivaluedMap h =3D new MultivaluedMapImpl();
+ h.putSingle("content-type", "application/json");
+ h.putSingle("content-length", "" + jsonBookData.length);
+ assertEquals(204, launcher.service("POST", "/", "", h, jsonBookData,=
null).getStatus());
+ unregistry(r1);
+ }
+
public void testJsonReturnBean() throws Exception
{
ResourceBook2 r2 =3D new ResourceBook2();
@@ -472,4 +516,30 @@
=
unregistry(r2);
}
+
+ public void testJsonReturnString() throws Exception
+ {
+ ResourceString2 r2 =3D new ResourceString2();
+ registry(r2);
+ MultivaluedMap h =3D new MultivaluedMapImpl();
+ h.putSingle("accept", "application/json");
+ ByteArrayContainerResponseWriter writer =3D new ByteArrayContainerRe=
sponseWriter();
+
+ // ResourceString2#m1()
+ ContainerResponse response =3D launcher.service("GET", "/", "", h, n=
ull, writer, null);
+ assertEquals(200, response.getStatus());
+ assertEquals("application/json", response.getContentType().toString(=
));
+ assertEquals(jsonBook, response.getEntity());
+ //System.out.println("string: " + new String(writer.getBody()));
+
+ // ResourceString2#m2()
+ writer.reset();
+ response =3D launcher.service("POST", "/", "", h, null, writer, null=
);
+ assertEquals(200, response.getStatus());
+ assertEquals("application/json", response.getContentType().toString(=
));
+ assertEquals(jsonBook, response.getEntity());
+ //System.out.println("string: " + new String(writer.getBody()));
+
+ unregistry(r2);
+ }
}
--===============4544228671371904538==--
From do-not-reply at jboss.org Wed Oct 6 10:10:46 2010
Content-Type: multipart/mixed; boundary="===============4700205266526843519=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3252 - in
kernel/trunk/exo.kernel.component.common:
src/main/java/org/exoplatform/services and 6 other directories.
Date: Wed, 06 Oct 2010 10:10:45 -0400
Message-ID: <201010061410.o96EAjl0022360@svn01.web.mwc.hst.phx2.redhat.com>
--===============4700205266526843519==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: nfilotto
Date: 2010-10-06 10:10:44 -0400 (Wed, 06 Oct 2010)
New Revision: 3252
Added:
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/s=
ervices/rpc/
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/s=
ervices/rpc/RPCException.java
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/s=
ervices/rpc/RPCService.java
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/s=
ervices/rpc/RemoteCommand.java
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/s=
ervices/rpc/SingleMethodCallCommand.java
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/s=
ervices/rpc/impl/
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/s=
ervices/rpc/impl/RPCServiceImpl.java
kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/s=
ervices/rpc/
kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/s=
ervices/rpc/impl/
kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/s=
ervices/rpc/impl/TestRPCServiceImpl.java
kernel/trunk/exo.kernel.component.common/src/test/resources/conf/portal/=
udp.xml
Modified:
kernel/trunk/exo.kernel.component.common/pom.xml
Log:
EXOJCR-967: Implementation of the RPCService
Modified: kernel/trunk/exo.kernel.component.common/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/trunk/exo.kernel.component.common/pom.xml 2010-10-06 09:31:29 UT=
C (rev 3251)
+++ kernel/trunk/exo.kernel.component.common/pom.xml 2010-10-06 14:10:44 UT=
C (rev 3252)
@@ -93,6 +93,10 @@
javax.transaction
jta
+
+ jgroups
+ jgroups
+
Added: kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatfo=
rm/services/rpc/RPCException.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/=
services/rpc/RPCException.java (rev 0)
+++ kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/=
services/rpc/RPCException.java 2010-10-06 14:10:44 UTC (rev 3252)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.rpc;
+
+/**
+ * The root class of all the Exception related to the RPC Service
+ * =
+ * @author Nicolas Fi=
lotto
+ * @version $Id$
+ */
+public class RPCException extends Exception
+{
+
+ /**
+ * The serial version UID
+ */
+ private static final long serialVersionUID =3D -9113831373947878170L;
+
+ public RPCException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public RPCException(String message)
+ {
+ super(message);
+ }
+}
Added: kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatfo=
rm/services/rpc/RPCService.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/=
services/rpc/RPCService.java (rev 0)
+++ kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/=
services/rpc/RPCService.java 2010-10-06 14:10:44 UTC (rev 3252)
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.rpc;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * This service provides mechanism to communicate with the other cluster n=
odes. This service will
+ * be based of JGroups as an underlying Transport.
+ * @author Nicolas Fi=
lotto
+ * @version $Id$
+ */
+public interface RPCService
+{
+
+ /**
+ * The permission needed to access to any methods of the RPCService
+ */
+ public static final RuntimePermission ACCESS_RPC_SERVICE_PERMISSION =3D=
new RuntimePermission("accessRPCService");
+
+ /**
+ * Executes a command on all the cluster nodes. This method is equivale=
nt to the other method of the
+ * same type but with the default timeout. The command must be register=
ed first otherwise an =
+ * {@link RPCException} will be thrown.
+ *
+ * @param command The command to execute on each cluster node
+ * @param synchronous if true, sets group request mode to {@link org.jg=
roups.blocks.GroupRequest#GET_ALL},
+ * and if false sets it to {@link org.jgroups.blocks.GroupRequest#GET_=
NONE}.
+ * @param args an array of {@link Serializable} objects corresponding t=
o parameters of the command =
+ * to execute remotely
+ * @return a list of responses from all the members of the cluster. If =
we met an exception on a given node, =
+ * the RPCException will be the corresponding response of this particul=
ar node
+ * @throws RPCException in the event of problems.
+ * @throws SecurityException if the {@link SecurityManager} is installe=
d and the call method
+ * doesn't have the {@link RuntimePermission} ACCESS_RPC_SERVICE_=
PERMISSION
+ */
+ List executeCommandOnAllNodes(RemoteCommand command, boolean sy=
nchronous, Serializable... args)
+ throws RPCException, SecurityException;
+
+ /**
+ * Executes a command synchronously on all the cluster nodes. The comma=
nd must be registered first otherwise an =
+ * {@link RPCException} will be thrown.
+ *
+ * @param command The command to execute on each cluster node
+ * @param timeout a timeout after which to throw a replication exceptio=
n.
+ * @param args an array of {@link Serializable} objects corresponding t=
o parameters of the command =
+ * to execute remotely
+ * @return a list of responses from all the members of the cluster. If =
we met an exception on a given node, =
+ * the RPCException will be the corresponding response of this particul=
ar node
+ * @throws RPCException in the event of problems.
+ * @throws SecurityException if the {@link SecurityManager} is installe=
d and the call method
+ * doesn't have the {@link RuntimePermission} ACCESS_RPC_SERVICE_=
PERMISSION
+ */
+ List executeCommandOnAllNodes(RemoteCommand command, long timeo=
ut, Serializable... args)
+ throws RPCException, SecurityException;
+
+ /**
+ * Executes a command on the coordinator only. This method is equivalen=
t to the other method of the
+ * same type but with the default timeout. The command must be register=
ed first otherwise an =
+ * {@link RPCException} will be thrown.
+ *
+ * @param command The command to execute on the coordinator node
+ * @param synchronous if true, sets group request mode to {@link org.jg=
roups.blocks.GroupRequest#GET_ALL}, =
+ * and if false sets it to {@link org.jgroups.blocks.GroupRequest#GET_N=
ONE}.
+ * @param args an array of {@link Serializable} objects corresponding t=
o parameters of the command =
+ * to execute remotely
+ * @return the response of the coordinator.
+ * @throws RPCException in the event of problems.
+ * @throws SecurityException if the {@link SecurityManager} is installe=
d and the call method
+ * doesn't have the {@link RuntimePermission} ACCESS_RPC_SERVICE_=
PERMISSION
+ */
+ Object executeCommandOnCoordinator(RemoteCommand command, boolean synch=
ronous, Serializable... args)
+ throws RPCException, SecurityException;
+
+ /**
+ * Executes a command synchronously on the coordinator only. The comman=
d must be registered first otherwise an =
+ * {@link RPCException} will be thrown.
+ *
+ * @param command The command to execute on the coordinator node
+ * @param timeout a timeout after which to throw a replication exceptio=
n.
+ * @param args an array of {@link Serializable} objects corresponding t=
o parameters of the command =
+ * to execute remotely
+ * @return the response of the coordinator.
+ * @throws RPCException in the event of problems.
+ * @throws SecurityException if the {@link SecurityManager} is installe=
d and the call method
+ * doesn't have the {@link RuntimePermission} ACCESS_RPC_SERVICE_=
PERMISSION
+ */
+ Object executeCommandOnCoordinator(RemoteCommand command, long timeout,=
Serializable... args) throws RPCException,
+ SecurityException;
+
+ /**
+ * Register a new {@link RemoteCommand} instance, it will be mapped to =
its id. If a command with the
+ * same Id has already been registered, a warning will be printed into =
the log file and the new
+ * command will replace the old one.
+ * @param command the instance of the {@link RemoteCommand} to register
+ * @return the command itself if it could be registered null otherwise =
+ * @throws SecurityException if the {@link SecurityManager} is installe=
d and the call method
+ * doesn't have the {@link RuntimePermission} ACCESS_RPC_SERVICE_=
PERMISSION
+ */
+ RemoteCommand registerCommand(RemoteCommand command) throws SecurityExc=
eption;
+
+ /**
+ * Unregister a {@link RemoteCommand} instance, if the id is known or t=
he instance itself is known
+ * otherwise it will be ignored
+ * @param command the command to unregister
+ * @throws SecurityException if the {@link SecurityManager} is installe=
d and the call method
+ * doesn't have the {@link RuntimePermission} ACCESS_RPC_SERVICE_=
PERMISSION
+ */
+ void unregisterCommand(RemoteCommand command) throws SecurityException;
+}
\ No newline at end of file
Added: kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatfo=
rm/services/rpc/RemoteCommand.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/=
services/rpc/RemoteCommand.java (rev 0)
+++ kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/=
services/rpc/RemoteCommand.java 2010-10-06 14:10:44 UTC (rev 3252)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.rpc;
+
+import java.io.Serializable;
+
+/**
+ * This class represents the command that can be executed on a remote ser=
ver.
+ * A RemoteCommand needs to be ThreadSafe since it can be re-used by seve=
ral
+ * threads in parallel.
+ * @author Nicolas Fi=
lotto
+ * @version $Id$
+ */
+public interface RemoteCommand
+{
+ /**
+ * This method will execute the command on the local machine.
+ * @param container The container from which the services needed for th=
e command
+ * will be extracted
+ * @param args The parameters needed to execute the command
+ * @return arbitrary return value generated by performing this command
+ * @throws Throwable in the event of problems.
+ */
+ Serializable execute(Serializable[] args) throws Throwable;
+
+ /**
+ * Gives the id of the command
+ * @return the unique ID of the command
+ */
+ String getId();
+}
Added: kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatfo=
rm/services/rpc/SingleMethodCallCommand.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/=
services/rpc/SingleMethodCallCommand.java (rev 0)
+++ kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/=
services/rpc/SingleMethodCallCommand.java 2010-10-06 14:10:44 UTC (rev 3252)
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.rpc;
+
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Arrays;
+
+/**
+ * This command will allow you to call one specific method with the argume=
nts given by the execute method
+ * on a component.
+ * =
+ * @author Nicolas Fi=
lotto
+ * @version $Id$
+ */
+public class SingleMethodCallCommand implements RemoteCommand
+{
+
+ /**
+ * The component on which we want to execute the method
+ */
+ private final Object component;
+
+ /**
+ * The method that we want to call
+ */
+ private final Method method;
+
+ /**
+ * The id of the command
+ */
+ private final String id;
+
+ /**
+ * =
+ * @param component the component on which we want to execute the method
+ * @param methodName the name of the method
+ * @param parameterTypes the parameter array
+ * @throws NoSuchMethodException if a matching method is not found.
+ * @exception SecurityException
+ * If a security manager, s , is present and any of =
the
+ * following conditions is met:
+ *
+ *
+ *
+ * invocation of =
+ * {@link SecurityManager#checkMemberAccess
+ * s.checkMemberAccess(this, Member.DECLARED)} denies
+ * access to the declared method
+ *
+ * the caller's class loader is not the same as or an
+ * ancestor of the class loader for the current class and
+ * invocation of {@link SecurityManager#checkPackageAc=
cess
+ * s.checkPackageAccess()} denies access to the packa=
ge
+ * of this class
+ *
+ *
+ * @throws ClassNotFoundException If the last parameter type is an arra=
y and we =
+ * cannot find the type of the array
+ */
+ public SingleMethodCallCommand(Object component, String methodName, Cla=
ss>... parameterTypes)
+ throws SecurityException, NoSuchMethodException, ClassNotFoundExcept=
ion
+ {
+ if (component =3D=3D null)
+ {
+ throw new IllegalArgumentException("The component cannot be null"=
);
+ }
+ if (methodName =3D=3D null || (methodName =3D methodName.trim()).len=
gth() =3D=3D 0)
+ {
+ throw new IllegalArgumentException("The methodName cannot be empt=
y");
+ }
+ this.component =3D component;
+ this.method =3D component.getClass().getDeclaredMethod(methodName, p=
arameterTypes);
+ if (!Modifier.isPublic(method.getModifiers()))
+ {
+ throw new IllegalArgumentException("The method '" + methodName + =
"' is not public");
+ }
+ this.id =3D getId(component, method);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Serializable execute(Serializable[] args) throws Throwable
+ {
+ try
+ {
+ return (Serializable)method.invoke(component, (Object[])args);
+ }
+ catch (Exception e)
+ {
+ throw new Exception("Could not execute the method " + id + " with=
the arguments " + Arrays.toString(args), e);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getId()
+ {
+ return id;
+ }
+
+ /**
+ * Gives a unique Id from the component and the method
+ */
+ private static String getId(Object component, Method method)
+ {
+ StringBuilder sb =3D new StringBuilder();
+ sb.append(component.getClass().getName());
+ sb.append('.');
+ sb.append(method.getName());
+ sb.append('(');
+ boolean first =3D true;
+ for (Class> c : method.getParameterTypes())
+ {
+ if (first)
+ {
+ first =3D false;
+ }
+ else
+ {
+ sb.append(',');
+ }
+ sb.append(c.getSimpleName());
+ }
+ sb.append(')');
+ return sb.toString();
+ }
+}
Added: kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatfo=
rm/services/rpc/impl/RPCServiceImpl.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/=
services/rpc/impl/RPCServiceImpl.java (rev 0)
+++ kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/=
services/rpc/impl/RPCServiceImpl.java 2010-10-06 14:10:44 UTC (rev 3252)
@@ -0,0 +1,788 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.rpc.impl;
+
+import org.exoplatform.commons.utils.PropertyManager;
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.ExoContainerContext;
+import org.exoplatform.container.configuration.ConfigurationManager;
+import org.exoplatform.container.xml.InitParams;
+import org.exoplatform.container.xml.ValueParam;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+import org.exoplatform.services.rpc.RPCException;
+import org.exoplatform.services.rpc.RPCService;
+import org.exoplatform.services.rpc.RemoteCommand;
+import org.jgroups.Address;
+import org.jgroups.Channel;
+import org.jgroups.ChannelException;
+import org.jgroups.JChannel;
+import org.jgroups.MembershipListener;
+import org.jgroups.Message;
+import org.jgroups.View;
+import org.jgroups.blocks.GroupRequest;
+import org.jgroups.blocks.MessageDispatcher;
+import org.jgroups.blocks.RequestHandler;
+import org.jgroups.conf.ConfiguratorFactory;
+import org.jgroups.conf.ProtocolStackConfigurator;
+import org.jgroups.util.Rsp;
+import org.jgroups.util.RspList;
+import org.picocontainer.Startable;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.io.Serializable;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+import java.util.concurrent.CountDownLatch;
+
+/**
+ * This class is a basic implementation of the {@link RPCService}, it is m=
ainly based on the
+ * {@link MessageDispatcher}. This implementation is not designed to give =
the best possible
+ * performances, it only aims to give a way to communicate with other node=
s.
+ * =
+ * @author Nicolas Fi=
lotto
+ * @version $Id$
+ */
+public class RPCServiceImpl implements RPCService, Startable, RequestHandl=
er, MembershipListener
+{
+
+ /**
+ * Connection logger.
+ */
+ private static final Log LOG =3D ExoLogger.getLogger("exo.kernel.compon=
ent.common.RPCServiceImpl");
+
+ /**
+ * The name of the parameter for the location of the JGroups configurat=
ion.
+ */
+ public static final String PARAM_JGROUPS_CONFIG =3D "jgroups-configurat=
ion";
+
+ /**
+ * The name of the parameter for the name of the cluster.
+ */
+ public static final String PARAM_CLUSTER_NAME =3D "jgroups-cluster-name=
";
+
+ /**
+ * The name of the parameter for the default timeout
+ */
+ public static final String PARAM_DEFAULT_TIMEOUT =3D "jgroups-default-t=
imeout";
+
+ /**
+ * The value of the default timeout
+ */
+ public static final int DEFAULT_TIMEOUT =3D 0;
+
+ /**
+ * The default value of the cluster name
+ */
+ public static final String CLUSTER_NAME =3D "RPCService-Cluster";
+
+ /**
+ * The configurator used to create the JGroups Channel
+ */
+ private final ProtocolStackConfigurator configurator;
+
+ /**
+ * The name of the cluster
+ */
+ private final String clusterName;
+
+ /**
+ * The JGroups Channel used to communicate with other nodes
+ */
+ protected Channel channel;
+
+ /**
+ * The current list of all the members of the cluster
+ */
+ protected volatile Vector members;
+
+ /**
+ * The address of the current coordinator
+ */
+ protected volatile Address coordinator;
+
+ /**
+ * The default value of the timeout
+ */
+ private long defaultTimeout =3D DEFAULT_TIMEOUT;
+
+ /**
+ * The dispatcher used to launch the command of the cluster nodes
+ */
+ private MessageDispatcher dispatcher;
+
+ /**
+ * The signal that indicates that the service is started, it will be us=
ed
+ * to make the application wait until the service is fully started to
+ * ensure that all the commands have been registered before handling
+ * incoming messages.
+ */
+ private final CountDownLatch startSignal =3D new CountDownLatch(1);
+
+ /**
+ * Current State of the {@link RPCServiceImpl}
+ */
+ private volatile State state;
+
+ /**
+ * All the commands that have been registered
+ */
+ private volatile Map commands =3D
+ Collections.unmodifiableMap(new HashMap());
+
+ /**
+ * The public constructor
+ * @param ctx the {@link ExoContainerContext} from which we will extrac=
t the corresponding
+ * {@link ExoContainer}
+ * @param params the list of initial parameters
+ * @param configManager the configuration manager used to get the confi=
guration
+ * of JGroups
+ */
+ public RPCServiceImpl(ExoContainerContext ctx, InitParams params, Confi=
gurationManager configManager)
+ {
+ if (params =3D=3D null)
+ {
+ throw new IllegalArgumentException("The RPCServiceImpl requires s=
ome parameters");
+ }
+ URL properties =3D getProperties(params, configManager);
+ if (LOG.isInfoEnabled())
+ {
+ LOG.info("The JGroups configuration used for the RPCServiceImpl w=
ill be loaded from " + properties);
+ }
+ try
+ {
+ this.configurator =3D ConfiguratorFactory.getStackConfigurator(pr=
operties);
+ }
+ catch (ChannelException e)
+ {
+ throw new RuntimeException("Cannot load the JGroups configuration=
from " + properties, e);
+ }
+ this.clusterName =3D getClusterName(ctx, params);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("The cluster name of the RPCServiceImpl has been set to=
" + clusterName);
+ }
+ String sTimeout =3D getValueParam(params, PARAM_DEFAULT_TIMEOUT);
+ if (sTimeout !=3D null)
+ {
+ defaultTimeout =3D Integer.parseInt(sTimeout);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("The default timeout of the RPCServiceImpl has been =
set to " + defaultTimeout);
+ }
+ }
+ this.state =3D State.INITIALIZED;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public List executeCommandOnAllNodes(RemoteCommand command, boo=
lean synchronous, Serializable... args)
+ throws RPCException
+ {
+ return executeCommandOnAllNodesMain(command, synchronous, defaultTim=
eout, args);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public List executeCommandOnAllNodes(RemoteCommand command, lon=
g timeout, Serializable... args)
+ throws RPCException
+ {
+ return executeCommandOnAllNodesMain(command, true, timeout, args);
+ }
+
+ /**
+ * Executes a command on all the cluster nodes. This method is equivale=
nt to the other method of the
+ * same type but with the default timeout. The command must be register=
ed first otherwise an =
+ * {@link RPCException} will be thrown.
+ *
+ * @param command The command to execute on each cluster node
+ * @param synchronous if true, sets group request mode to {@link org.jg=
roups.blocks.GroupRequest#GET_ALL},
+ * and if false sets it to {@link org.jgroups.blocks.GroupRequest#GET_=
NONE}.
+ * @param timeout a timeout after which to throw a replication exceptio=
n.
+ * @param args an array of {@link Serializable} objects corresponding t=
o parameters of the command =
+ * to execute remotely
+ * @return a list of responses from all the members of the cluster. If =
we met an exception on a given node, =
+ * the RPCException will be the corresponding response of this particul=
ar node
+ * @throws RPCException in the event of problems.
+ */
+ protected List executeCommandOnAllNodesMain(RemoteCommand comma=
nd, boolean synchronous, long timeout,
+ Serializable... args) throws RPCException
+ {
+ return excecuteCommand(members, command, synchronous, timeout, args);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object executeCommandOnCoordinator(RemoteCommand command, boolea=
n synchronous, Serializable... args)
+ throws RPCException
+ {
+ return executeCommandOnCoordinatorMain(command, synchronous, default=
Timeout, args);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object executeCommandOnCoordinator(RemoteCommand command, long t=
imeout, Serializable... args)
+ throws RPCException
+ {
+ return executeCommandOnCoordinatorMain(command, true, timeout, args);
+ }
+
+ /**
+ * Executes a command on the coordinator only. This method is equivalen=
t to the other method of the
+ * same type but with the default timeout. The command must be register=
ed first otherwise an =
+ * {@link RPCException} will be thrown.
+ *
+ * @param command The command to execute on the coordinator node
+ * @param synchronous if true, sets group request mode to {@link org.jg=
roups.blocks.GroupRequest#GET_ALL}, =
+ * and if false sets it to {@link org.jgroups.blocks.GroupRequest#GET_N=
ONE}.
+ * @param timeout a timeout after which to throw a replication exceptio=
n.
+ * @param args an array of {@link Serializable} objects corresponding t=
o parameters of the command =
+ * to execute remotely
+ * @return the response of the coordinator.
+ * @throws RPCException in the event of problems.
+ */
+ protected Object executeCommandOnCoordinatorMain(RemoteCommand command,=
boolean synchronous, long timeout,
+ Serializable... args) throws RPCException
+ {
+ Address coordinator =3D this.coordinator;
+ Vector v =3D new Vector(1);
+ v.add(coordinator);
+ List lResults =3D excecuteCommand(v, command, synchronous, t=
imeout, args);
+ Object result =3D lResults =3D=3D null || lResults.size() =3D=3D 0 ?=
null : lResults.get(0);
+ if (result instanceof MemberHasLeftException)
+ {
+ if (coordinator.equals(this.coordinator))
+ {
+ throw new RPCException("The coordinator did not change, we fac=
ed an unexpected situation",
+ (MemberHasLeftException)result);
+ }
+ else
+ {
+ // The coordinator has changed, we will automatically retry wi=
th the new coordinator
+ return executeCommandOnCoordinator(command, synchronous, timeo=
ut, args);
+ }
+ }
+ else if (result instanceof RPCException)
+ {
+ throw (RPCException)result;
+ }
+ return result;
+ }
+
+ /**
+ * Execute the command on all the nodes corresponding to the list of de=
stinations.
+ * @param dests the list of members on which the command needs to be ex=
ecuted
+ * @param command the command to execute
+ * @param synchronous if true, sets group request mode to {@link org.jg=
roups.blocks.GroupRequest#GET_ALL}, and if false sets =
+ * it to {@link org.jgroups.blocks.GroupRequest#GET_NONE}.
+ * @param timeout a timeout after which to throw a replication exceptio=
n.
+ * @param args the list of parameters
+ * @return a list of responses from all the targeted members of the clu=
ster.
+ * @throws RPCException in the event of problems.
+ */
+ protected List excecuteCommand(final Vector dests, Rem=
oteCommand command,
+ final boolean synchronous, final long timeout, Serializable... args)=
throws RPCException
+ {
+ SecurityManager security =3D System.getSecurityManager();
+ if (security !=3D null)
+ {
+ security.checkPermission(RPCService.ACCESS_RPC_SERVICE_PERMISSION=
);
+ }
+ if (state !=3D State.STARTED)
+ {
+ throw new RPCException(
+ "Cannot execute any commands if the service is not started, th=
e current state of the service is " + state);
+ }
+ String commandId =3D command.getId();
+ if (commands.get(commandId) !=3D command)
+ {
+ throw new RPCException("Command " + commandId + " unknown, please=
register your command first");
+ }
+ final Message msg =3D new Message();
+ msg.setObject(new MessageBody(commandId, args));
+ RspList rsps =3D AccessController.doPrivileged(new PrivilegedAction<=
RspList>()
+ {
+ public RspList run()
+ {
+ return dispatcher.castMessage(dests, msg, synchronous ? GroupR=
equest.GET_ALL : GroupRequest.GET_NONE,
+ timeout);
+ }
+ });
+
+ if (LOG.isTraceEnabled())
+ LOG.trace("responses: " + rsps);
+ if (rsps =3D=3D null)
+ throw new RPCException("Could not get the responses for command "=
+ commandId + ".");
+ if (!synchronous)
+ return Collections.emptyList();// async case
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("(" + channel.getLocalAddress() + "): responses for com=
mand " + commandId + ":\n" + rsps);
+ }
+ List retval =3D new ArrayList(rsps.size());
+ for (Address dest : dests)
+ {
+ Rsp rsp =3D rsps.get(dest);
+ if (rsp =3D=3D null || (rsp.wasSuspected() && !rsp.wasReceived()))
+ {
+ // The corresponding member has left
+ retval.add(new MemberHasLeftException("No response for the mem=
ber " + dest
+ + ", this member has probably left the cluster."));
+ }
+ else if (!rsp.wasReceived())
+ {
+ retval.add(new RPCException("Replication timeout for " + rsp.g=
etSender() + ", rsp=3D" + rsp));
+ }
+ else
+ {
+ Object value =3D rsp.getValue();
+ if (value instanceof RPCException)
+ {
+ // if we have any application-level exceptions make sure we=
throw them!!
+ if (LOG.isTraceEnabled())
+ LOG.trace("Recieved exception'" + value + "' from " + rs=
p.getSender(), (RPCException)value);
+ }
+ retval.add(value);
+ }
+ }
+ return retval;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object handle(Message msg)
+ {
+ String commandId =3D null;
+ try
+ {
+ // Ensure that the service is fully started before trying to exec=
ute any command
+ startSignal.await();
+ MessageBody body =3D (MessageBody)msg.getObject();
+ RemoteCommand command =3D getCommand(commandId =3D body.getComman=
dId());
+ if (command =3D=3D null)
+ {
+ return new RPCException("Command " + commandId + " unkown, ple=
ase register your command first");
+ }
+ Object execResult =3D command.execute(body.getArgs());
+ if (LOG.isTraceEnabled())
+ LOG.trace("Command : " + commandId + " executed, result is: " =
+ execResult);
+ return execResult;
+ }
+ catch (Throwable x)
+ {
+ if (LOG.isTraceEnabled())
+ LOG.trace("Problems invoking command.", x);
+ return new RPCException("Cannot execute the command " + (commandI=
d =3D=3D null ? "" : commandId), x);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void block()
+ {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void suspect(Address suspectedMbr)
+ {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void viewAccepted(View view)
+ {
+ this.members =3D view.getMembers();
+ this.coordinator =3D members !=3D null && members.size() > 0 ? membe=
rs.get(0) : null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public synchronized RemoteCommand registerCommand(RemoteCommand command)
+ {
+ SecurityManager security =3D System.getSecurityManager();
+ if (security !=3D null)
+ {
+ security.checkPermission(RPCService.ACCESS_RPC_SERVICE_PERMISSION=
);
+ }
+ if (command !=3D null)
+ {
+ String commandId =3D command.getId();
+ if (commandId =3D=3D null)
+ {
+ throw new IllegalArgumentException("The command Id cannot be n=
ull");
+ }
+ Map tmpCommands =3D new HashMap(this.commands);
+ RemoteCommand oldCommand =3D tmpCommands.put(commandId, command);
+ if (oldCommand !=3D null && PropertyManager.isDevelopping())
+ {
+ LOG.warn("A command has already been registered with the id " =
+ commandId
+ + ", this command will be replaced with the new one");
+ }
+ this.commands =3D Collections.unmodifiableMap(tmpCommands);
+ return command;
+ }
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public synchronized void unregisterCommand(RemoteCommand command)
+ {
+ SecurityManager security =3D System.getSecurityManager();
+ if (security !=3D null)
+ {
+ security.checkPermission(RPCService.ACCESS_RPC_SERVICE_PERMISSION=
);
+ }
+ if (command !=3D null)
+ {
+ String commandId =3D command.getId();
+ if (commandId =3D=3D null)
+ {
+ throw new IllegalArgumentException("The command Id cannot be n=
ull");
+ }
+ if (commands.get(commandId) !=3D command)
+ {
+ // We prevent to remove any command that has not been register=
ed, thus we expect that
+ // the registered instance is exactly the same instance as the=
one that we want to
+ // unregister
+ if (PropertyManager.isDevelopping())
+ {
+ LOG.warn("Cannot unregister an unknown RemoteCommand, eithe=
r the command id " + commandId
+ + " is unknown or the instance of RemoteCommand to unreg=
ister is unknown");
+ }
+ return;
+ }
+ Map tmpCommands =3D new HashMap(this.commands);
+ tmpCommands.remove(commandId);
+ this.commands =3D Collections.unmodifiableMap(tmpCommands);
+ }
+ }
+
+ /**
+ * Gives the {@link RemoteCommand} corresponding to the given id
+ * @param commandId the command id of the command to retrieve
+ * @return the corresponding {@link RemoteCommand}
+ */
+ protected RemoteCommand getCommand(String commandId)
+ {
+ return commands.get(commandId);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void start()
+ {
+ SecurityManager security =3D System.getSecurityManager();
+ if (security !=3D null)
+ {
+ security.checkPermission(RPCService.ACCESS_RPC_SERVICE_PERMISSION=
);
+ }
+ try
+ {
+ this.channel =3D new JChannel(configurator);
+ channel.setOpt(Channel.AUTO_RECONNECT, true);
+ this.dispatcher =3D new MessageDispatcher(channel, null, this, th=
is);
+ doPriviledgedExceptionAction(new PrivilegedExceptionAction()
+ {
+ public Void run() throws Exception
+ {
+ channel.connect(clusterName);
+ return null;
+ }
+ });
+ }
+ catch (ChannelException e)
+ {
+ throw new RuntimeException("Cannot initialize the Channel needed =
for the RPCServiceImpl", e);
+ }
+ finally
+ {
+ this.state =3D State.STARTED;
+ startSignal.countDown();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void stop()
+ {
+ SecurityManager security =3D System.getSecurityManager();
+ if (security !=3D null)
+ {
+ security.checkPermission(RPCService.ACCESS_RPC_SERVICE_PERMISSION=
);
+ }
+ this.state =3D State.STOPPED;
+ if (channel !=3D null && channel.isOpen())
+ {
+ if (LOG.isInfoEnabled())
+ LOG.info("Disconnecting and closing the Channel");
+ AccessController.doPrivileged(new PrivilegedAction()
+ {
+ public Void run()
+ {
+ channel.disconnect();
+ return null;
+ }
+ });
+ channel.close();
+ channel =3D null;
+ }
+ if (dispatcher !=3D null)
+ {
+ dispatcher.stop();
+ dispatcher =3D null;
+ }
+ }
+
+ /**
+ * Gives the value of the default timeout
+ * @return the default timeout
+ */
+ public long getDefaultTimeout()
+ {
+ return defaultTimeout;
+ }
+
+ /**
+ * Gives the name of the cluster
+ * @return the name of the cluster
+ */
+ public String getClusterName()
+ {
+ return clusterName;
+ }
+
+ /**
+ * Gives the value of the {@link ValueParam} corresponding to the given=
key
+ * @param params the list of initial parameters from which we want to e=
xtract the {@link ValueParam}
+ * @param parameterKey the name of the {@link ValueParam} that we are l=
ooking for
+ * @return the value if it exists, null otherwise
+ */
+ private static String getValueParam(InitParams params, String parameter=
Key)
+ {
+ try
+ {
+ return params.getValueParam(parameterKey).getValue().trim();
+ }
+ catch (NullPointerException e)
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Gives the {@link URL} corresponding to the location of the JGroups c=
onfiguration
+ * @param params the initial parameters from which we extract the param=
eter =
+ * PARAM_JGROUPS_CONFIG
=
+ * @param configManager the configuration manager used to get the {@lin=
k URL} corresponding
+ * to the path given in the configuration of the RPCServiceImpl
+ * @return The {@link URL} corresponding to the location of the JGroups=
configuration,
+ * it will throw {@link RuntimeException} otherwise since it is a manda=
tory configuration.
+ */
+ private static URL getProperties(InitParams params, ConfigurationManage=
r configManager)
+ {
+ String configPath =3D getValueParam(params, PARAM_JGROUPS_CONFIG);
+ if (configPath =3D=3D null)
+ {
+ throw new IllegalArgumentException("The parameter '" + PARAM_JGRO=
UPS_CONFIG
+ + "' of RPCServiceImpl is mandatory");
+ }
+ URL properties;
+ try
+ {
+ properties =3D configManager.getResource(configPath);
+ }
+ catch (Exception e)
+ {
+ throw new IllegalArgumentException("Cannot find the JGroups confi=
guration at " + configPath, e);
+ }
+ if (properties =3D=3D null)
+ {
+ throw new IllegalArgumentException("Cannot find the JGroups confi=
guration at " + configPath);
+ }
+ return properties;
+ }
+
+ /**
+ * Gives the name of the cluster that will be able to support several p=
ortal containers
+ * since the name will be post fixed with "-${container-name}"
+ * @param ctx the context from which we extract the name of the contain=
er
+ * @param params the list of initial parameters from which we get the v=
alue of the parameter
+ * PARAM_CLUSTER_NAME
if it exists otherwise the value wil=
l be "RPCService-Cluster"
+ */
+ private static String getClusterName(ExoContainerContext ctx, InitParam=
s params)
+ {
+ String clusterName =3D getValueParam(params, PARAM_CLUSTER_NAME);
+ if (clusterName =3D=3D null)
+ {
+ clusterName =3D CLUSTER_NAME;
+ }
+ return clusterName +=3D "-" + ctx.getName();
+ }
+
+ /**
+ * Execute a privilege action
+ */
+ private static E doPriviledgedExceptionAction(PrivilegedExceptionAc=
tion action) throws ChannelException
+ {
+ try
+ {
+ return AccessController.doPrivileged(action);
+ }
+ catch (PrivilegedActionException pae)
+ {
+ Throwable cause =3D pae.getCause();
+ if (cause instanceof ChannelException)
+ {
+ throw (ChannelException)cause;
+ }
+ else if (cause instanceof RuntimeException)
+ {
+ throw (RuntimeException)cause;
+ }
+ else
+ {
+ throw new RuntimeException(cause);
+ }
+ }
+ }
+
+ /**
+ * This intern class will be used to =
+ */
+ public static class MessageBody implements Externalizable
+ {
+ /**
+ * The Id of the command to execute
+ */
+ private String commandId;
+
+ /**
+ * The list of parameters;
+ */
+ private Serializable[] args;
+
+ public MessageBody()
+ {
+ }
+
+ public MessageBody(String commandId, Serializable[] args)
+ {
+ this.commandId =3D commandId;
+ this.args =3D args;
+ }
+
+ public String getCommandId()
+ {
+ return commandId;
+ }
+
+ public Serializable[] getArgs()
+ {
+ return args;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void readExternal(ObjectInput in) throws IOException, ClassNo=
tFoundException
+ {
+ this.commandId =3D in.readUTF();
+ int size =3D in.readInt();
+ if (size =3D=3D -1)
+ {
+ this.args =3D null;
+ }
+ else
+ {
+ this.args =3D new Serializable[size];
+ for (int i =3D 0; i < size; i++)
+ {
+ args[i] =3D (Serializable)in.readObject();
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ out.writeUTF(commandId);
+ if (args =3D=3D null)
+ {
+ out.writeInt(-1);
+ }
+ else
+ {
+ out.writeInt(args.length);
+ for (int i =3D 0; i < args.length; i++)
+ {
+ out.writeObject(args[i]);
+ }
+ }
+ }
+ }
+
+ /**
+ * All the potential states of the {@link RPCServiceImpl}
+ */
+ public enum State {
+ INITIALIZED, STARTED, STOPPED
+ }
+
+ public static class MemberHasLeftException extends RPCException
+ {
+
+ /**
+ * The serial version UID
+ */
+ private static final long serialVersionUID =3D 3558158913564367637L;
+
+ public MemberHasLeftException(String message)
+ {
+ super(message);
+ }
+ }
+}
Added: kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatfo=
rm/services/rpc/impl/TestRPCServiceImpl.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/=
services/rpc/impl/TestRPCServiceImpl.java (rev 0)
+++ kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/=
services/rpc/impl/TestRPCServiceImpl.java 2010-10-06 14:10:44 UTC (rev 3252)
@@ -0,0 +1,1062 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.rpc.impl;
+
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.container.configuration.ConfigurationManager;
+import org.exoplatform.container.xml.InitParams;
+import org.exoplatform.container.xml.ValueParam;
+import org.exoplatform.services.rpc.RPCException;
+import org.exoplatform.services.rpc.RemoteCommand;
+import org.exoplatform.services.rpc.SingleMethodCallCommand;
+import org.exoplatform.services.rpc.impl.RPCServiceImpl.MemberHasLeftExcep=
tion;
+import org.exoplatform.test.BasicTestCase;
+import org.jgroups.Address;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicReference;
+
+/**
+ * This is the unit test class for the service {@link RPCServiceImpl}
+ * =
+ * @author Nicolas Fi=
lotto
+ * @version $Id$
+ *
+ */
+public class TestRPCServiceImpl extends BasicTestCase
+{
+ private PortalContainer container;
+ private ConfigurationManager configManager;
+ =
+ public void setUp() throws Exception
+ {
+ container =3D PortalContainer.getInstance();
+ configManager =3D (ConfigurationManager)container.getComponentInstan=
ceOfType(ConfigurationManager.class);
+ }
+ =
+ public void testParameters()
+ {
+ InitParams params =3D null;
+ try
+ {
+ new RPCServiceImpl(container.getContext(), params, configManager);
+ fail("We expect a IllegalArgumentException since the jgroups conf=
ig cannot be found");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // OK
+ }
+ params =3D new InitParams();
+ try
+ {
+ new RPCServiceImpl(container.getContext(), params, configManager);
+ fail("We expect a IllegalArgumentException since the jgroups conf=
ig cannot be found");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // OK
+ }
+ ValueParam paramConf =3D new ValueParam();
+ paramConf.setName(RPCServiceImpl.PARAM_JGROUPS_CONFIG);
+ params.addParameter(paramConf);
+ try
+ {
+ new RPCServiceImpl(container.getContext(), params, configManager);
+ fail("We expect a IllegalArgumentException since the jgroups conf=
ig cannot be found");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // OK
+ }
+ paramConf.setValue("fakePath");
+ try
+ {
+ new RPCServiceImpl(container.getContext(), params, configManager);
+ fail("We expect a IllegalArgumentException since the jgroups conf=
ig cannot be found");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // OK
+ }
+ paramConf.setValue("jar:/conf/portal/udp.xml");
+ RPCServiceImpl service =3D null;
+ try
+ {
+ service =3D new RPCServiceImpl(container.getContext(), params, co=
nfigManager);
+ assertEquals(RPCServiceImpl.DEFAULT_TIMEOUT, service.getDefaultTi=
meout());
+ assertEquals(RPCServiceImpl.CLUSTER_NAME + "-" + container.getCon=
text().getName(), service.getClusterName());
+ }
+ finally
+ {
+ if (service !=3D null)
+ {
+ service.stop(); =
+ }
+ }
+ ValueParam paramTimeout =3D new ValueParam();
+ paramTimeout.setName(RPCServiceImpl.PARAM_DEFAULT_TIMEOUT);
+ paramTimeout.setValue("fakeValue");
+ params.addParameter(paramTimeout);
+ try
+ {
+ new RPCServiceImpl(container.getContext(), params, configManager);
+ fail("We expect a NumberFormatException since the timeout is not =
properly set");
+ }
+ catch (NumberFormatException e)
+ {
+ // OK
+ }
+ paramTimeout.setValue("60");
+ try
+ {
+ service =3D new RPCServiceImpl(container.getContext(), params, co=
nfigManager);
+ assertEquals(60, service.getDefaultTimeout());
+ assertEquals(RPCServiceImpl.CLUSTER_NAME + "-" + container.getCon=
text().getName(), service.getClusterName());
+ }
+ finally
+ {
+ if (service !=3D null)
+ {
+ service.stop(); =
+ }
+ }
+ ValueParam paramClusterName =3D new ValueParam();
+ paramClusterName.setName(RPCServiceImpl.PARAM_CLUSTER_NAME);
+ paramClusterName.setValue("MyName");
+ params.addParameter(paramClusterName);
+ try
+ {
+ service =3D new RPCServiceImpl(container.getContext(), params, co=
nfigManager);
+ assertEquals(60, service.getDefaultTimeout());
+ assertEquals(paramClusterName.getValue() + "-" + container.getCon=
text().getName(), service.getClusterName());
+ }
+ finally
+ {
+ if (service !=3D null)
+ {
+ service.stop(); =
+ }
+ }
+ }
+ =
+ public void testStates() throws Exception
+ {
+ InitParams params =3D new InitParams();
+ ValueParam paramConf =3D new ValueParam();
+ paramConf.setName(RPCServiceImpl.PARAM_JGROUPS_CONFIG);
+ paramConf.setValue("jar:/conf/portal/udp.xml"); =
+ params.addParameter(paramConf);
+ RPCServiceImpl service =3D null;
+ RemoteCommand foo =3D new RemoteCommand()
+ {
+ =
+ public String getId()
+ {
+ return "foo";
+ }
+ =
+ public String execute(Serializable[] args) throws Throwable
+ {
+ return null;
+ }
+ };
+ try
+ {
+ service =3D new RPCServiceImpl(container.getContext(), params, co=
nfigManager);
+ =
+ service.registerCommand(foo);
+ try
+ {
+ service.executeCommandOnAllNodes(foo, true);
+ fail("We expect a RPCException since the current state is not =
the expected one");
+ }
+ catch (RPCException e)
+ {
+ // OK
+ }
+ try
+ {
+ service.executeCommandOnAllNodes(foo, 10);
+ fail("We expect a RPCException since the current state is not =
the expected one");
+ }
+ catch (RPCException e)
+ {
+ // OK
+ }
+ try
+ {
+ service.executeCommandOnCoordinator(foo, true);
+ fail("We expect a RPCException since the current state is not =
the expected one");
+ }
+ catch (RPCException e)
+ {
+ // OK
+ }
+ try
+ {
+ service.executeCommandOnCoordinator(foo, 10);
+ fail("We expect a RPCException since the current state is not =
the expected one");
+ }
+ catch (RPCException e)
+ {
+ // OK
+ }
+ service.start();
+ service.executeCommandOnAllNodes(foo, true);
+ service.executeCommandOnAllNodes(foo, 10);
+ service.executeCommandOnCoordinator(foo, true);
+ service.executeCommandOnCoordinator(foo, 10);
+ }
+ finally
+ {
+ if (service !=3D null)
+ {
+ service.stop(); =
+ }
+ }
+ try
+ {
+ service.executeCommandOnAllNodes(foo, true);
+ fail("We expect a RPCException since the current state is not the=
expected one");
+ }
+ catch (RPCException e)
+ {
+ // OK
+ }
+ try
+ {
+ service.executeCommandOnAllNodes(foo, 10);
+ fail("We expect a RPCException since the current state is not the=
expected one");
+ }
+ catch (RPCException e)
+ {
+ // OK
+ }
+ try
+ {
+ service.executeCommandOnCoordinator(foo, true);
+ fail("We expect a RPCException since the current state is not the=
expected one");
+ }
+ catch (RPCException e)
+ {
+ // OK
+ }
+ try
+ {
+ service.executeCommandOnCoordinator(foo, 10);
+ fail("We expect a RPCException since the current state is not the=
expected one");
+ }
+ catch (RPCException e)
+ {
+ // OK
+ } =
+ }
+ =
+ public void testCommands() throws Exception
+ {
+ InitParams params =3D new InitParams();
+ ValueParam paramConf =3D new ValueParam();
+ paramConf.setName(RPCServiceImpl.PARAM_JGROUPS_CONFIG);
+ paramConf.setValue("jar:/conf/portal/udp.xml"); =
+ params.addParameter(paramConf);
+ RPCServiceImpl service =3D null;
+ try
+ {
+ service =3D new RPCServiceImpl(container.getContext(), params, co=
nfigManager);
+ RemoteCommand fake =3D new RemoteCommand()
+ {
+ =
+ public String getId()
+ {
+ return "fake";
+ }
+ =
+ public String execute(Serializable[] args) throws Throwable
+ {
+ return null;
+ }
+ };
+ RemoteCommand fake2 =3D new RemoteCommand()
+ {
+ =
+ public String getId()
+ {
+ return "fake2";
+ }
+ =
+ public String execute(Serializable[] args) throws Throwable
+ {
+ return null;
+ }
+ };
+ RemoteCommand fake2_Unregistered =3D new RemoteCommand()
+ {
+ =
+ public String getId()
+ {
+ return "fake2";
+ }
+ =
+ public String execute(Serializable[] args) throws Throwable
+ {
+ return null;
+ }
+ }; =
+ service.registerCommand(fake2);
+ RemoteCommand Exception =3D new RemoteCommand()
+ {
+ =
+ public String getId()
+ {
+ return "Exception";
+ }
+ =
+ public String execute(Serializable[] args) throws Throwable
+ {
+ throw new Exception("MyException");
+ }
+ };
+ service.registerCommand(Exception);
+ RemoteCommand Error =3D new RemoteCommand()
+ {
+ =
+ public String getId()
+ {
+ return "Error";
+ }
+ =
+ public String execute(Serializable[] args) throws Throwable
+ {
+ throw new Error("MyError");
+ }
+ } ;
+ service.registerCommand(Error);
+ RemoteCommand StringValue =3D new RemoteCommand()
+ {
+ =
+ public String getId()
+ {
+ return "StringValue";
+ }
+ =
+ public String execute(Serializable[] args) throws Throwable
+ {
+ return "OK";
+ }
+ }; =
+ service.registerCommand(StringValue);
+ RemoteCommand NullValue =3D new RemoteCommand()
+ {
+ =
+ public String getId()
+ {
+ return "NullValue";
+ }
+ =
+ public String execute(Serializable[] args) throws Throwable
+ {
+ return null;
+ }
+ }; =
+ service.registerCommand(NullValue);
+ RemoteCommand LongTask =3D new RemoteCommand()
+ {
+ =
+ public String getId()
+ {
+ return "LongTask";
+ }
+ =
+ public String execute(Serializable[] args) throws Throwable
+ {
+ Thread.sleep(2000);
+ return null;
+ }
+ }; =
+ service.registerCommand(LongTask); =
+ service.start();
+ try
+ {
+ service.executeCommandOnAllNodes(fake, true);
+ fail("We expect a RPCException since the command is unknown");
+ }
+ catch (RPCException e)
+ {
+ // OK
+ }
+ try
+ {
+ service.executeCommandOnCoordinator(fake, true);
+ fail("We expect a RPCException since the command is unknown");
+ }
+ catch (RPCException e)
+ {
+ // OK
+ }
+ try
+ {
+ service.executeCommandOnAllNodes(fake2_Unregistered, true);
+ fail("We expect a RPCException since the command is unknown");
+ }
+ catch (RPCException e)
+ {
+ // OK
+ }
+ try
+ {
+ service.executeCommandOnCoordinator(fake2_Unregistered, true);
+ fail("We expect a RPCException since the command is unknown");
+ }
+ catch (RPCException e)
+ {
+ // OK
+ } =
+ List result;
+ result =3D service.executeCommandOnAllNodes(Exception, true);
+ assertTrue(result !=3D null && result.size() =3D=3D 1);
+ assertTrue("We expect a RPCException since one node could not exe=
cute the command", result.get(0) instanceof RPCException);
+ try
+ {
+ service.executeCommandOnCoordinator(Exception, true);
+ fail("We expect a RPCException since one node could not execut=
e the command");
+ }
+ catch (RPCException e)
+ {
+ // OK
+ }
+ result =3D service.executeCommandOnAllNodes(Error, true);
+ assertTrue(result !=3D null && result.size() =3D=3D 1);
+ assertTrue("We expect a RPCException since one node could not exe=
cute the command", result.get(0) instanceof RPCException);
+ try
+ {
+ service.executeCommandOnCoordinator(Error, true);
+ fail("We expect a RPCException since one node could not execut=
e the command");
+ }
+ catch (RPCException e)
+ {
+ // OK
+ }
+ result =3D service.executeCommandOnAllNodes(LongTask, true);
+ assertNotNull(result);
+ assertTrue(result.size() =3D=3D 1);
+ assertNull(result.get(0));
+ Object o =3D service.executeCommandOnCoordinator(LongTask, true);
+ assertNull(o);
+ result =3D service.executeCommandOnAllNodes(LongTask, 1000);
+ assertNotNull(result);
+ assertTrue(result.size() =3D=3D 1);
+ assertTrue("We expect an RPCException due to a Replication Timeou=
t", result.get(0) instanceof RPCException);
+ try
+ {
+ service.executeCommandOnCoordinator(LongTask, 1000);
+ fail("We expect an RPCException due to a Replication Timeout");
+ }
+ catch (RPCException e)
+ {
+ // OK
+ }
+ result =3D service.executeCommandOnAllNodes(LongTask, false);
+ assertNotNull(result);
+ assertTrue(result.isEmpty());
+ assertNull(service.executeCommandOnCoordinator(LongTask, false));
+ =
+ result =3D service.executeCommandOnAllNodes(StringValue, true);
+ assertNotNull(result);
+ assertTrue(result.size() =3D=3D 1);
+ assertEquals("OK", result.get(0));
+ o =3D service.executeCommandOnCoordinator(StringValue, true);
+ assertEquals("OK", o);
+ result =3D service.executeCommandOnAllNodes(NullValue, true);
+ assertNotNull(result);
+ assertTrue(result.size() =3D=3D 1);
+ assertNull(result.get(0));
+ o =3D service.executeCommandOnCoordinator(NullValue, true);
+ assertNull(o);
+ }
+ finally
+ {
+ if (service !=3D null)
+ {
+ service.stop(); =
+ }
+ } =
+ }
+
+ public void testSeveralNodes() throws Exception
+ {
+ InitParams params =3D new InitParams();
+ ValueParam paramConf =3D new ValueParam();
+ paramConf.setName(RPCServiceImpl.PARAM_JGROUPS_CONFIG);
+ paramConf.setValue("jar:/conf/portal/udp.xml"); =
+ params.addParameter(paramConf);
+ RPCServiceImpl service1 =3D null, service2 =3D null;
+ try
+ {
+ service1 =3D new RPCServiceImpl(container.getContext(), params, c=
onfigManager);
+ service2 =3D new RPCServiceImpl(container.getContext(), params, c=
onfigManager);
+ RemoteCommand CmdUnknownOnNode2 =3D new RemoteCommand()
+ {
+ =
+ public String getId()
+ {
+ return "CmdUnknownOnNode2";
+ }
+ =
+ public String execute(Serializable[] args) throws Throwable
+ {
+ return "OK";
+ }
+ };
+ service1.registerCommand(CmdUnknownOnNode2);
+ RemoteCommand ExceptionOnNode2 =3D new RemoteCommand()
+ {
+ =
+ public String getId()
+ {
+ return "ExceptionOnNode2";
+ }
+ =
+ public String execute(Serializable[] args) throws Throwable
+ {
+ return "OK";
+ }
+ }; =
+ service1.registerCommand(ExceptionOnNode2);
+ RemoteCommand ErrorOnNode2 =3D new RemoteCommand()
+ {
+ =
+ public String getId()
+ {
+ return "ErrorOnNode2";
+ }
+ =
+ public String execute(Serializable[] args) throws Throwable
+ {
+ return "OK";
+ }
+ }; =
+ service1.registerCommand(ErrorOnNode2);
+ =
+ RemoteCommand LongTaskOnNode2 =3D new RemoteCommand()
+ {
+ =
+ public String getId()
+ {
+ return "LongTaskOnNode2";
+ }
+ =
+ public String execute(Serializable[] args) throws Throwable
+ {
+ return "OK";
+ }
+ }; =
+ service1.registerCommand(LongTaskOnNode2); =
+ service1.registerCommand(new RemoteCommand()
+ {
+ =
+ public String getId()
+ {
+ return "LongTask";
+ }
+ =
+ public String execute(Serializable[] args) throws Throwable
+ {
+ Thread.sleep(20000);
+ return "OldCoordinator";
+ }
+ }); =
+ service1.registerCommand(new RemoteCommand()
+ {
+ =
+ public String getId()
+ {
+ return "OK";
+ }
+ =
+ public String execute(Serializable[] args) throws Throwable
+ {
+ return "OK";
+ }
+ }); =
+ service2.registerCommand(new RemoteCommand()
+ {
+ =
+ public String getId()
+ {
+ return "ExceptionOnNode2";
+ }
+ =
+ public String execute(Serializable[] args) throws Throwable
+ {
+ throw new Exception("MyException");
+ }
+ });
+ service2.registerCommand(new RemoteCommand()
+ {
+ =
+ public String getId()
+ {
+ return "ErrorOnNode2";
+ }
+ =
+ public String execute(Serializable[] args) throws Throwable
+ {
+ throw new Error("MyError");
+ }
+ });
+ service2.registerCommand(new RemoteCommand()
+ {
+ =
+ public String getId()
+ {
+ return "LongTaskOnNode2";
+ }
+ =
+ public String execute(Serializable[] args) throws Throwable
+ {
+ Thread.sleep(2000);
+ return null;
+ }
+ });
+ RemoteCommand OK =3D new RemoteCommand()
+ {
+ =
+ public String getId()
+ {
+ return "OK";
+ }
+ =
+ public String execute(Serializable[] args) throws Throwable
+ {
+ return "OK";
+ }
+ };
+ service2.registerCommand(OK);
+ final RemoteCommand LongTask =3D new RemoteCommand()
+ {
+ =
+ public String getId()
+ {
+ return "LongTask";
+ }
+ =
+ public String execute(Serializable[] args) throws Throwable
+ {
+ return "NewCoordinator";
+ }
+ };
+ service2.registerCommand(LongTask); =
+ service1.start();
+ service2.start();
+ List result;
+ Object o;
+ result =3D service1.executeCommandOnAllNodes(CmdUnknownOnNode2, t=
rue);
+ assertTrue(result !=3D null && result.size() =3D=3D 2);
+ assertEquals("OK", result.get(0));
+ assertTrue("We expect a RPCException since the command is unknown=
on node 2", result.get(1) instanceof RPCException);
+ o =3D service1.executeCommandOnCoordinator(CmdUnknownOnNode2, tru=
e);
+ assertEquals("OK", o);
+
+ result =3D service1.executeCommandOnAllNodes(ExceptionOnNode2, tr=
ue);
+ assertTrue(result !=3D null && result.size() =3D=3D 2);
+ assertEquals("OK", result.get(0));
+ assertTrue("We expect a RPCException since the command fails on n=
ode 2", result.get(1) instanceof RPCException);
+ o =3D service1.executeCommandOnCoordinator(ExceptionOnNode2, true=
);
+ assertEquals("OK", o);
+
+ result =3D service1.executeCommandOnAllNodes(ErrorOnNode2, true);
+ assertTrue(result !=3D null && result.size() =3D=3D 2);
+ assertEquals("OK", result.get(0));
+ assertTrue("We expect a RPCException since the command fails on n=
ode 2", result.get(1) instanceof RPCException); =
+ o =3D service1.executeCommandOnCoordinator(ErrorOnNode2, true);
+ assertEquals("OK", o);
+ =
+ result =3D service1.executeCommandOnAllNodes(LongTaskOnNode2, 100=
0);
+ assertNotNull(result);
+ assertTrue(result.size() =3D=3D 2);
+ assertEquals("OK", result.get(0));
+ assertTrue("We expect an RPCException due to a Replication Timeou=
t", result.get(1) instanceof RPCException);
+ o =3D service1.executeCommandOnCoordinator(LongTaskOnNode2, 1000);
+ assertEquals("OK", o);
+ =
+ Vector allMembers =3D service1.members;
+ Vector coordinatorOnly =3D new Vector(1);
+ coordinatorOnly.add(service1.coordinator);
+ =
+ final RPCServiceImpl service =3D service2;
+ final AtomicReference error =3D new AtomicReference();
+ final CountDownLatch doneSignal =3D new CountDownLatch(1);
+ Thread t =3D new Thread()
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ Object o =3D service.executeCommandOnCoordinator(LongTas=
k, true);
+ assertEquals("NewCoordinator", o);
+ }
+ catch (Throwable e)
+ {
+ error.set(e);
+ }
+ finally
+ {
+ doneSignal.countDown();
+ }
+ } =
+ };
+ t.start();
+ service1.stop();
+ doneSignal.await();
+ assertNull(error.get() !=3D null ? error.get().getMessage() : "",=
error.get());
+ result =3D service2.excecuteCommand(allMembers, OK, true, 0);
+ assertNotNull(result);
+ assertTrue(result.size() =3D=3D 2);
+ assertTrue("We expect an RPCException due to a member that has le=
ft", result.get(0) instanceof MemberHasLeftException);
+ assertEquals("OK", result.get(1));
+ result =3D service2.excecuteCommand(coordinatorOnly, OK, true, 0);
+ assertNotNull(result);
+ assertTrue(result.size() =3D=3D 1);
+ assertTrue("We expect an RPCException due to a member that has le=
ft", result.get(0) instanceof MemberHasLeftException);
+ }
+ finally
+ {
+ if (service1 !=3D null)
+ {
+ service1.stop(); =
+ }
+ if (service2 !=3D null)
+ {
+ service2.stop(); =
+ }
+ } =
+ }
+ =
+ public void testSingleMethodCallCommand() throws Exception
+ {
+ try
+ {
+ new SingleMethodCallCommand(null, null);
+ fail("we expect an IllegalArgumentException");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // OK
+ }
+ MyService myService =3D new MyService();
+ try
+ {
+ new SingleMethodCallCommand(myService, null);
+ fail("we expect an IllegalArgumentException");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // OK
+ }
+ try
+ {
+ new SingleMethodCallCommand(myService, "foo");
+ fail("we expect an NoSuchMethodException");
+ }
+ catch (NoSuchMethodException e)
+ {
+ // OK
+ }
+ try
+ {
+ new SingleMethodCallCommand(myService, "getPrivateName");
+ fail("we expect an IllegalArgumentException since only the public=
methods are allowed");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // OK
+ }
+ InitParams params =3D new InitParams();
+ ValueParam paramConf =3D new ValueParam();
+ paramConf.setName(RPCServiceImpl.PARAM_JGROUPS_CONFIG);
+ paramConf.setValue("jar:/conf/portal/udp.xml"); =
+ params.addParameter(paramConf);
+ RPCServiceImpl service =3D null;
+ try
+ {
+ service =3D new RPCServiceImpl(container.getContext(), params, co=
nfigManager);
+ RemoteCommand getName =3D service.registerCommand(new SingleMetho=
dCallCommand(myService, "getName"));
+ RemoteCommand add =3D service.registerCommand(new SingleMethodCal=
lCommand(myService, "add", int.class));
+ RemoteCommand evaluate1 =3D service.registerCommand(new SingleMet=
hodCallCommand(myService, "evaluate", int[].class));
+ RemoteCommand evaluate2 =3D service.registerCommand(new SingleMet=
hodCallCommand(myService, "evaluate", List.class));
+ RemoteCommand total1 =3D service.registerCommand(new SingleMethod=
CallCommand(myService, "total", int.class));
+ RemoteCommand total2 =3D service.registerCommand(new SingleMethod=
CallCommand(myService, "total", int.class, int.class));
+ RemoteCommand total3 =3D service.registerCommand(new SingleMethod=
CallCommand(myService, "total", int[].class));
+ RemoteCommand total4 =3D service.registerCommand(new SingleMethod=
CallCommand(myService, "total", String.class, long.class, int[].class));
+ RemoteCommand testTypes1 =3D service.registerCommand(new SingleMe=
thodCallCommand(myService, "testTypes", String[].class));
+ RemoteCommand testTypes2 =3D service.registerCommand(new SingleMe=
thodCallCommand(myService, "testTypes", int[].class));
+ RemoteCommand testTypes3 =3D service.registerCommand(new SingleMe=
thodCallCommand(myService, "testTypes", long[].class));
+ RemoteCommand testTypes4 =3D service.registerCommand(new SingleMe=
thodCallCommand(myService, "testTypes", byte[].class));
+ RemoteCommand testTypes5 =3D service.registerCommand(new SingleMe=
thodCallCommand(myService, "testTypes", short[].class));
+ RemoteCommand testTypes6 =3D service.registerCommand(new SingleMe=
thodCallCommand(myService, "testTypes", char[].class));
+ RemoteCommand testTypes7 =3D service.registerCommand(new SingleMe=
thodCallCommand(myService, "testTypes", double[].class));
+ RemoteCommand testTypes8 =3D service.registerCommand(new SingleMe=
thodCallCommand(myService, "testTypes", float[].class));
+ RemoteCommand testTypes9 =3D service.registerCommand(new SingleMe=
thodCallCommand(myService, "testTypes", boolean[].class));
+
+ service.start();
+ List result;
+ =
+ assertEquals("name", service.executeCommandOnCoordinator(getName,=
true));
+ result =3D service.executeCommandOnAllNodes(getName, true);
+ assertTrue(result !=3D null && result.size() =3D=3D 1);
+ assertEquals("name", result.get(0));
+ =
+ assertEquals(10, service.executeCommandOnCoordinator(add, true, 1=
0));
+ result =3D service.executeCommandOnAllNodes(add, true, 10);
+ assertTrue(result !=3D null && result.size() =3D=3D 1);
+ assertEquals(20, result.get(0));
+ =
+ assertEquals(100, service.executeCommandOnCoordinator(evaluate1, =
true, new int[]{10, 10, 10, 30, 40}));
+ result =3D service.executeCommandOnAllNodes(evaluate1, true, new =
int[]{10, 10, 10, 30, 40});
+ assertTrue(result !=3D null && result.size() =3D=3D 1);
+ assertEquals(100, result.get(0));
+ =
+ List values =3D new ArrayList();
+ values.add(10);
+ values.add(10);
+ values.add(10);
+ values.add(30);
+ values.add(40);
+ assertEquals(100, service.executeCommandOnCoordinator(evaluate2, =
true, (Serializable)values));
+ result =3D service.executeCommandOnAllNodes(evaluate2, true, (Ser=
ializable)values);
+ assertTrue(result !=3D null && result.size() =3D=3D 1);
+ assertEquals(100, result.get(0));
+ =
+ assertEquals(10, service.executeCommandOnCoordinator(total1, true=
, 10));
+ result =3D service.executeCommandOnAllNodes(total1, true, 10);
+ assertTrue(result !=3D null && result.size() =3D=3D 1);
+ assertEquals(10, result.get(0));
+ =
+ assertEquals(20, service.executeCommandOnCoordinator(total2, true=
, 10, 10));
+ result =3D service.executeCommandOnAllNodes(total2, true, 10, 10);
+ assertTrue(result !=3D null && result.size() =3D=3D 1);
+ assertEquals(20, result.get(0));
+ =
+ assertEquals(100, service.executeCommandOnCoordinator(total3, tru=
e, new int[]{10, 10, 10, 30, 40}));
+ result =3D service.executeCommandOnAllNodes(total3, true, new int=
[]{10, 10, 10, 30, 40});
+ assertTrue(result !=3D null && result.size() =3D=3D 1);
+ assertEquals(100, result.get(0));
+ =
+ assertEquals(100, service.executeCommandOnCoordinator(total4, tru=
e, "foo", 50, new int[]{10, 10, 10, 30, 40}));
+ result =3D service.executeCommandOnAllNodes(total4, true, "foo", =
50, new int[]{10, 10, 10, 30, 40});
+ assertTrue(result !=3D null && result.size() =3D=3D 1);
+ assertEquals(100, result.get(0));
+ =
+ assertEquals(0, service.executeCommandOnCoordinator(total4, true,=
"foo", 50, null));
+ result =3D service.executeCommandOnAllNodes(total4, true, "foo", =
50, null);
+ assertTrue(result !=3D null && result.size() =3D=3D 1);
+ assertEquals(0, result.get(0));
+ =
+ try
+ {
+ service.executeCommandOnCoordinator(total4, true, "foo", 50);
+ fail("We expect a RPCException since the list of arguments mis=
match with what is expected");
+ }
+ catch (RPCException e)
+ {
+ // OK
+ } =
+ result =3D service.executeCommandOnAllNodes(total4, true, "foo", =
50);
+ assertTrue(result !=3D null && result.size() =3D=3D 1);
+ assertTrue("We expect a RPCException since the list of arguments =
mismatch with what is expected", result.get(0) instanceof RPCException);
+ =
+ assertEquals("foo", service.executeCommandOnCoordinator(testTypes=
1, true, (Serializable)new String[]{"foo"}));
+ result =3D service.executeCommandOnAllNodes(testTypes1, true, (Se=
rializable)new String[]{"foo"});
+ assertTrue(result !=3D null && result.size() =3D=3D 1);
+ assertEquals("foo", result.get(0));
+ =
+ assertEquals(10, service.executeCommandOnCoordinator(testTypes2, =
true, new int[]{10}));
+ result =3D service.executeCommandOnAllNodes(testTypes2, true, new=
int[]{10});
+ assertTrue(result !=3D null && result.size() =3D=3D 1);
+ assertEquals(10, result.get(0));
+ =
+ assertEquals(11L, service.executeCommandOnCoordinator(testTypes3,=
true, new long[]{10}));
+ result =3D service.executeCommandOnAllNodes(testTypes3, true, new=
long[]{10});
+ assertTrue(result !=3D null && result.size() =3D=3D 1);
+ assertEquals(11L, result.get(0));
+ =
+ assertEquals((byte)12, service.executeCommandOnCoordinator(testTy=
pes4, true, new byte[]{10}));
+ result =3D service.executeCommandOnAllNodes(testTypes4, true, new=
byte[]{10});
+ assertTrue(result !=3D null && result.size() =3D=3D 1);
+ assertEquals((byte)12, result.get(0));
+ =
+ assertEquals((short)13, service.executeCommandOnCoordinator(testT=
ypes5, true, new short[]{10}));
+ result =3D service.executeCommandOnAllNodes(testTypes5, true, new=
short[]{10});
+ assertTrue(result !=3D null && result.size() =3D=3D 1);
+ assertEquals((short)13, result.get(0));
+ =
+ assertEquals('a', service.executeCommandOnCoordinator(testTypes6,=
true, new char[]{'a'}));
+ result =3D service.executeCommandOnAllNodes(testTypes6, true, new=
char[]{'a'});
+ assertTrue(result !=3D null && result.size() =3D=3D 1);
+ assertEquals('a', result.get(0));
+ =
+ assertEquals(10.5, service.executeCommandOnCoordinator(testTypes7=
, true, new double[]{10}));
+ result =3D service.executeCommandOnAllNodes(testTypes7, true, new=
double[]{10});
+ assertTrue(result !=3D null && result.size() =3D=3D 1);
+ assertEquals(10.5, result.get(0));
+ =
+ assertEquals((float)11.5, service.executeCommandOnCoordinator(tes=
tTypes8, true, new float[]{10}));
+ result =3D service.executeCommandOnAllNodes(testTypes8, true, new=
float[]{10});
+ assertTrue(result !=3D null && result.size() =3D=3D 1);
+ assertEquals((float)11.5, result.get(0));
+ =
+ assertEquals(true, service.executeCommandOnCoordinator(testTypes9=
, true, new boolean[]{true}));
+ result =3D service.executeCommandOnAllNodes(testTypes9, true, new=
boolean[]{true});
+ assertTrue(result !=3D null && result.size() =3D=3D 1);
+ assertEquals(true, result.get(0));
+ =
+ }
+ finally
+ {
+ if (service !=3D null)
+ {
+ service.stop(); =
+ }
+ } =
+ }
+ =
+ public static class MyService
+ {
+ private int value =3D 0;
+ =
+ public int add(int i)
+ {
+ return value +=3D i;
+ }
+ =
+ @SuppressWarnings("unused")
+ private String getPrivateName()
+ {
+ return "name";
+ }
+ =
+ public String getName()
+ {
+ return "name";
+ }
+ =
+ public int total(int i)
+ {
+ return i;
+ }
+ =
+ public int total(int i1, int i2)
+ {
+ return i1 + i2;
+ }
+ =
+ public int total(int... values)
+ {
+ int total =3D 0;
+ for (int i : values)
+ {
+ total +=3D i;
+ }
+ return total;
+ }
+ =
+ public int total(String s, long l, int... values)
+ {
+ int total =3D 0;
+ if (values !=3D null)
+ {
+ for (int i : values)
+ {
+ total +=3D i;
+ } =
+ }
+ return total;
+ }
+ =
+ public int evaluate(int[] values)
+ {
+ int total =3D 0;
+ for (int i : values)
+ {
+ total +=3D i;
+ }
+ return total; =
+ }
+ =
+ public int evaluate(List values)
+ {
+ int total =3D 0;
+ for (int i : values)
+ {
+ total +=3D i;
+ }
+ return total; =
+ }
+ =
+ public String testTypes(String... values)
+ {
+ return values[0];
+ }
+ =
+ public boolean testTypes(boolean... values)
+ {
+ return values[0];
+ }
+ =
+ public char testTypes(char... values)
+ {
+ return values[0];
+ }
+ =
+ public double testTypes(double... values)
+ {
+ return values[0] + 0.5;
+ }
+ =
+ public float testTypes(float... values)
+ {
+ return (float)(values[0] + 1.5);
+ }
+ =
+ public int testTypes(int... values)
+ {
+ return values[0];
+ }
+ =
+ public long testTypes(long... values)
+ {
+ return values[0] + 1;
+ }
+ =
+ public byte testTypes(byte... values)
+ {
+ return (byte)(values[0] + 2);
+ }
+ =
+ public short testTypes(short... values)
+ {
+ return (short)(values[0] + 3);
+ }
+ }
+}
Added: kernel/trunk/exo.kernel.component.common/src/test/resources/conf/por=
tal/udp.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/trunk/exo.kernel.component.common/src/test/resources/conf/portal=
/udp.xml (rev 0)
+++ kernel/trunk/exo.kernel.component.common/src/test/resources/conf/portal=
/udp.xml 2010-10-06 14:10:44 UTC (rev 3252)
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--===============4700205266526843519==--
From do-not-reply at jboss.org Wed Oct 6 11:35:09 2010
Content-Type: multipart/mixed; boundary="===============8035668917933780445=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3253 -
kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/services/rpc/impl.
Date: Wed, 06 Oct 2010 11:35:09 -0400
Message-ID: <201010061535.o96FZ9Np031804@svn01.web.mwc.hst.phx2.redhat.com>
--===============8035668917933780445==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: nfilotto
Date: 2010-10-06 11:35:09 -0400 (Wed, 06 Oct 2010)
New Revision: 3253
Modified:
kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/s=
ervices/rpc/impl/TestRPCServiceImpl.java
Log:
EXOJCR-967: Extends the timeout to prevent issue with TestRPCServiceImpl.te=
stSeveralNodes
Modified: kernel/trunk/exo.kernel.component.common/src/test/java/org/exopla=
tform/services/rpc/impl/TestRPCServiceImpl.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/=
services/rpc/impl/TestRPCServiceImpl.java 2010-10-06 14:10:44 UTC (rev 3252)
+++ kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/=
services/rpc/impl/TestRPCServiceImpl.java 2010-10-06 15:35:09 UTC (rev 3253)
@@ -581,7 +581,7 @@
=
public String execute(Serializable[] args) throws Throwable
{
- Thread.sleep(20000);
+ Thread.sleep(30000);
return "OldCoordinator";
}
}); =
--===============8035668917933780445==--
From do-not-reply at jboss.org Wed Oct 6 13:09:15 2010
Content-Type: multipart/mixed; boundary="===============1352316116598990192=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3254 - in
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules:
kernel and 1 other directory.
Date: Wed, 06 Oct 2010 13:09:15 -0400
Message-ID: <201010061709.o96H9FgC015632@svn01.web.mwc.hst.phx2.redhat.com>
--===============1352316116598990192==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: nfilotto
Date: 2010-10-06 13:09:15 -0400 (Wed, 06 Oct 2010)
New Revision: 3254
Added:
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/=
modules/kernel/rpc-service.xml
Modified:
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/=
modules/kernel.xml
Log:
EXOJCR-967: The doc
Added: jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en=
-US/modules/kernel/rpc-service.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US=
/modules/kernel/rpc-service.xml (rev 0)
+++ jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US=
/modules/kernel/rpc-service.xml 2010-10-06 17:09:15 UTC (rev 3254)
@@ -0,0 +1,211 @@
+
+
+
+
+
+ RPC Service
+
+
+ Description
+
+ The RPCService is only needed in a cluser
+ environment, it is used to communicate with the other cluster nodes. It
+ allows to execute a command on all the cluster nodes or on the coordin=
ator
+ i.e. the oldest node in the cluster. The RPCService
+ has been designed to rely on JGroups capabilites and should not be used
+ for heavy load. It can be used for example to notify other nodes that
+ something happened or to collect some information from the other
+ nodes.
+
+ The RPCService relies on 2 main interfaces
+ which are the org.exoplatform.services.rpc.RPCService
+ that defines the service itslef and the
+ org.exoplatform.services.rpc.RemoteCommand that
+ defines the command that we can execute on other nodes. The arguments =
that
+ will be given to the RemoteCommand must be
+ Serializable and its return type also in order to
+ prevent any issue due to the serialization. To prevent to execute any
+ RemoteCommand that could be malicious and to allo=
w to
+ use non Serializable command, you need to register
+ the command first before using it. Since the service will keep only one
+ instance of RemoteCommand per command Id, the
+ implementation of the RemoteCommand must be thread
+ safe.
+
+ To be usable, all the RemoteCommand s must be
+ registered before being used on all the cluster nodes, which means that
+ the command registration must be done in the constructor of your compo=
nent
+ in other words before that the RPCService is star=
ted.
+ If you try to launch a command that has been registered but the
+ RPCService is not yet launched, you will get an
+ RPCException due to an illegal state. This has for
+ consequences that you will be able to execute a command only once your
+ component will be started.
+
+ See an example below:
+
+ public class MyService implements Startable
+{
+ private RPCService rpcService;
+ private RemoteCommand sayHelloCommand;
+ =
+ public MyService(RPCService rpcService)
+ {
+ this.rpcService =3D rpcService;
+ // Register the command before that the RPCService is started
+ sayHelloCommand =3D rpcService.registerCommand(new RemoteCommand()
+ {
+ public Serializable execute(Serializable[] args) throws Throwable
+ {
+ System.out.println("Hello !");
+ return null;
+ }
+
+ public String getId()
+ {
+ return "hello-world-command";
+ }
+ });
+ }
+
+ public void start()
+ {
+ // Since the RPCService is a dependency of RPCService, it will be st=
arted before
+ // so I can execute my command
+ try
+ {
+ // This will make all the nodes say "Hello !"
+ rpcService.executeCommandOnAllNodes(sayHelloCommand, false);
+ }
+ catch (SecurityException e)
+ {
+ e.printStackTrace();
+ }
+ catch (RPCException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void stop()
+ {
+ }
+}
+
+ In the previous example, We register the command
+ sayHelloCommand in the constructor of
+ MyService and we execute this command in the start
+ method.
+
+
+ We expect to have one RPCService instance=
per
+ PortalContainer in a portal mode and only one
+ RPCService instance in a standalone mode
+
+
+
+
+ Configuration
+
+ The configuration of the RPCService should =
be
+ added only in a cluster environment. See below an example of
+ configuration
+
+ <configuration>
+.... =
+ <component>
+ <key>org.exoplatform.services.rpc.RPCService</key>
+ <type>org.exoplatform.services.rpc.impl.RPCServiceImpl</type&=
gt;
+ <init-params>
+ <value-param>
+ <name>jgroups-configuration</name>
+ <value>classpath:/udp.xml</value>
+ </value-param>
+ <value-param>
+ <name>jgroups-cluster-name</name>
+ <value>RPCService-Cluster</value>
+ </value-param>
+ <value-param>
+ <name>jgroups-default-timeout</name>
+ <value>0</value>
+ </value-param>
+ </init-params>
+ </component> =
+...
+</configuration>
+
+
+ Fields description
+
+
+
+
+ jgroups-configuration
+
+ This is the location of the configuration of jgroups. T=
his
+ parameter is mandatory.
+
+
+
+ jgroups-cluster-name
+
+ This is the name of the cluster. This parameter is opti=
onal
+ and its default value is RPCService-Cluster.
+ Since we could have several instances of the
+ RPCService , the final name will be
+ "${jgroups-cluster-name}-${container-name}"
+
+
+
+ jgroups-default-timeout
+
+ This is the default timeout to use if the timeout is not
+ given, if no response could be get after this timeout an excep=
tion
+ will be thrown. This parameter is optional and its default val=
ue
+ is 0 which means that we don't use any timeout by default.
+
+
+
+
+
+
+
+ The SingleMethodCallCommand
+
+ Most of the time we only need to call a method on a given object,
+ this can be done thanks to the
+ org.exoplatform.services.rpc.SingleMethodCallCommand
+ which is the implementation of a RemoteCommand
+ proposed by default. This command will dynamically execute a method on=
a
+ given object.
+
+ // Register the command first
+RemoteCommand commandGetName =3D rpcService.registerCommand(new SingleMeth=
odCallCommand(myService, "getName"));
+// Execute the command on the coordinator
+String name =3D rpcService.executeCommandOnCoordinator(commandGetName, tru=
e);
+// Print the name
+System.out.println("Name : " + name);
+
+ This example:
+
+
+
+ Register a SingleMethodCallCommand that
+ will call getName() on the Object
+ myService anytime the command will be
+ executed.
+
+
+
+ Execute the command synchronously on the coordinator, assumi=
ng
+ that the same command (with the same id) has already been register=
ed
+ on the coordinator
+
+
+
+ Print the name got from the coordinator
+
+
+
+
Modified: jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook=
/en-US/modules/kernel.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US=
/modules/kernel.xml 2010-10-06 15:35:09 UTC (rev 3253)
+++ jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US=
/modules/kernel.xml 2010-10-06 17:09:15 UTC (rev 3254)
@@ -56,5 +56,8 @@
=
+
+
=
--===============1352316116598990192==--
From do-not-reply at jboss.org Thu Oct 7 02:54:55 2010
Content-Type: multipart/mixed; boundary="===============3526576404433336495=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3255 -
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/provider.
Date: Thu, 07 Oct 2010 02:54:55 -0400
Message-ID: <201010070654.o976stRj000697@svn01.web.mwc.hst.phx2.redhat.com>
--===============3526576404433336495==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: aparfonov
Date: 2010-10-07 02:54:54 -0400 (Thu, 07 Oct 2010)
New Revision: 3255
Modified:
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/im=
pl/provider/JsonEntityProvider.java
Log:
EXOJCR-992 : exclude some more types
Modified: ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/=
rest/impl/provider/JsonEntityProvider.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/i=
mpl/provider/JsonEntityProvider.java 2010-10-06 17:09:15 UTC (rev 3254)
+++ ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/i=
mpl/provider/JsonEntityProvider.java 2010-10-07 06:54:54 UTC (rev 3255)
@@ -34,6 +34,7 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;
+import java.io.Writer;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.Collection;
@@ -68,10 +69,11 @@
// Or probably enough check only content type 'application/json'
// and if this content type set trust it and try parse/write
=
- /** Do not process via JSON "known" JAX-RS types. */
+ /** Do not process via JSON "known" JAX-RS types and some more. */
private static final Class>[] IGNORED =3D
- new Class>[]{byte[].class, DataSource.class, DOMSource.class, File=
.class, InputStream.class, JAXBElement.class,
- MultivaluedMap.class, Reader.class, SAXSource.class, StreamingOut=
put.class, StreamSource.class, String.class};
+ new Class>[]{byte[].class, char[].class, DataSource.class, DOMSour=
ce.class, File.class, InputStream.class,
+ OutputStream.class, JAXBElement.class, MultivaluedMap.class, Read=
er.class, Writer.class, SAXSource.class,
+ StreamingOutput.class, StreamSource.class, String.class};
=
private static boolean isIgnored(Class> type)
{
--===============3526576404433336495==--
From do-not-reply at jboss.org Thu Oct 7 03:25:24 2010
Content-Type: multipart/mixed; boundary="===============2152708465595376496=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3256 - in
kernel/trunk/exo.kernel.component.common:
src/main/java/org/exoplatform/services/naming and 2 other directories.
Date: Thu, 07 Oct 2010 03:25:24 -0400
Message-ID: <201010070725.o977POF7008214@svn01.web.mwc.hst.phx2.redhat.com>
--===============2152708465595376496==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: tolusha
Date: 2010-10-07 03:25:24 -0400 (Thu, 07 Oct 2010)
New Revision: 3256
Modified:
kernel/trunk/exo.kernel.component.common/pom.xml
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/s=
ervices/naming/InitialContextBinder.java
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/s=
ervices/naming/InitialContextInitializer.java
kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/s=
ervices/naming/InitialContextTest.java
kernel/trunk/exo.kernel.component.common/src/test/resources/conf/portal/=
test-configuration.xml
Log:
EXOJCR-977: support different files for different InitialContextBinder inst=
ances
Modified: kernel/trunk/exo.kernel.component.common/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/trunk/exo.kernel.component.common/pom.xml 2010-10-07 06:54:54 UT=
C (rev 3255)
+++ kernel/trunk/exo.kernel.component.common/pom.xml 2010-10-07 07:25:24 UT=
C (rev 3256)
@@ -105,7 +105,6 @@
maven-surefire-plugin
- **/InitialContextTest.java
**/TransactionTest.java
Modified: kernel/trunk/exo.kernel.component.common/src/main/java/org/exopla=
tform/services/naming/InitialContextBinder.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/=
services/naming/InitialContextBinder.java 2010-10-07 06:54:54 UTC (rev 3255)
+++ kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/=
services/naming/InitialContextBinder.java 2010-10-07 07:25:24 UTC (rev 3256)
@@ -25,8 +25,8 @@
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Stack;
-import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
=
import javax.naming.NameAlreadyBoundException;
@@ -91,20 +91,16 @@
* initial context initializer
* @param initParams
* initialization parameters
- * @throws XMLStreamException =
* @throws FileNotFoundException =
- * @throws FileNotFoundException
* @throws XMLStreamException
- * @throws NamingException =
* @throws NamingException
*/
- InitialContextBinder(InitialContextInitializer initialContextInitialize=
r) throws FileNotFoundException,
- XMLStreamException, NamingException
+ InitialContextBinder(InitialContextInitializer initialContextInitialize=
r, String bindingsStorePath)
+ throws FileNotFoundException, XMLStreamException, NamingException
{
this.initialContextInitializer =3D initialContextInitializer;
-
this.bindings =3D new ConcurrentHashMap();
- this.bindingsStorePath =3D System.getProperty("java.io.tmpdir") + Fi=
le.separator + "bind-references.xml";
+ this.bindingsStorePath =3D bindingsStorePath;
=
if (new File(bindingsStorePath).exists())
{
@@ -117,6 +113,15 @@
}
=
/**
+ * InitialContextBinder constructor.
+ */
+ InitialContextBinder(InitialContextInitializer initialContextInitialize=
r) throws FileNotFoundException,
+ XMLStreamException, NamingException
+ {
+ this(initialContextInitializer, InitialContextInitializer.DEFAULT_BI=
NDING_STORE_PATH);
+ }
+
+ /**
* Constructs references from params, binds in initial contexts and per=
sists list of all binded
* references into file.
* =
Modified: kernel/trunk/exo.kernel.component.common/src/main/java/org/exopla=
tform/services/naming/InitialContextInitializer.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/=
services/naming/InitialContextInitializer.java 2010-10-07 06:54:54 UTC (rev=
3255)
+++ kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/=
services/naming/InitialContextInitializer.java 2010-10-07 07:25:24 UTC (rev=
3256)
@@ -23,9 +23,11 @@
import org.exoplatform.container.xml.InitParams;
import org.exoplatform.container.xml.PropertiesParam;
import org.exoplatform.container.xml.Property;
+import org.exoplatform.container.xml.ValueParam;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
=
+import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Collection;
@@ -55,6 +57,11 @@
=
final public static String PROPERTIES_MANDATORY =3D "mandatory-properti=
es";
=
+ final public static String BINDINGS_STORE_PATH =3D "bindings-store-path=
";
+
+ final public static String DEFAULT_BINDING_STORE_PATH =3D System.getPro=
perty("java.io.tmpdir") + File.separator
+ + "bind-references.xml";
+
private static Log LOG =3D ExoLogger.getLogger("exo.kernel.component.co=
mmon.InitialContextInitializer");
=
private List bindReferencesPlugins;
@@ -107,8 +114,18 @@
initialContext =3D new InitialContext();
bindReferencesPlugins =3D new ArrayList();
=
+ ValueParam bindingStorePathParam =3D params.getValueParam(BINDINGS_S=
TORE_PATH);
+
// binder
- binder =3D new InitialContextBinder(this);
+ if (bindingStorePathParam =3D=3D null)
+ {
+ binder =3D new InitialContextBinder(this, DEFAULT_BINDING_STORE_P=
ATH);
+ }
+ else
+ {
+ binder =3D new InitialContextBinder(this, bindingStorePathParam.g=
etValue());
+ }
+
}
=
private void setSystemProperty(String propName, String propValue, Strin=
g propParamName)
@@ -133,7 +150,7 @@
initialContext.rebind(name, reference);
=
// binder
- binder =3D new InitialContextBinder(this);
+ binder =3D new InitialContextBinder(this, DEFAULT_BINDING_STORE_PATH=
);
}
=
/**
Modified: kernel/trunk/exo.kernel.component.common/src/test/java/org/exopla=
tform/services/naming/InitialContextTest.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/=
services/naming/InitialContextTest.java 2010-10-07 06:54:54 UTC (rev 3255)
+++ kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/=
services/naming/InitialContextTest.java 2010-10-07 07:25:24 UTC (rev 3256)
@@ -18,18 +18,24 @@
*/
package org.exoplatform.services.naming;
=
-import junit.framework.TestCase;
-
-import org.exoplatform.container.StandaloneContainer;
-
+import java.io.File;
+import java.io.FileNotFoundException;
import java.util.Enumeration;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
=
import javax.naming.CompositeName;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.Name;
+import javax.naming.NamingException;
+import javax.xml.stream.XMLStreamException;
=
+import junit.framework.TestCase;
+
+import org.exoplatform.container.PortalContainer;
+
/**
* Created by The eXo Platform SAS . Prerequisites: default-context-f=
actory
* =3D org.exoplatform.services.naming.impl.SimpleContextFactory
@@ -42,14 +48,14 @@
=
private static String TEST_CONTEXT_FACTORY =3D "org.exoplatform.service=
s.naming.SimpleContextFactory";
=
- private StandaloneContainer container;
+ private PortalContainer container;
=
public void setUp() throws Exception
{
=
- StandaloneContainer.setConfigurationPath("src/test/java/conf/standal=
one/test-configuration.xml");
+ // StandaloneContainer.setConfigurationPath("src/test/resources=
/conf/standalone/test-configuration.xml");
=
- container =3D StandaloneContainer.getInstance();
+ container =3D PortalContainer.getInstance();
}
=
public void testConfig() throws Exception
@@ -98,4 +104,27 @@
}
}
=
+ /* =
+ * Tests if InitialContextInitializer correctly gets bindings-store-pat=
h from =
+ * param-value and pass it to InitialContexBinder, thus provides usage =
of different files
+ * for different instances of the class. =
+ */
+ public void testDifferentFileUsage() throws FileNotFoundException, Nami=
ngException, XMLStreamException
+ {
+
+ InitialContextInitializer initializer =3D
+ (InitialContextInitializer)container.getComponentInstanceOfType(I=
nitialContextInitializer.class);
+
+ Map refAddr =3D new HashMap();
+ refAddr.put("driverClassName", "org.hsqldb.jdbcDriver");
+ refAddr.put("url", "jdbc:hsqldb:file:target/temp/data/portal");
+ refAddr.put("username", "sa");
+ refAddr.put("password", "");
+
+ initializer.bind("testjdbcjcr1", "javax.sql.DataSource", "org.apache=
.commons.dbcp.BasicDataSourceFactory", null,
+ refAddr);
+
+ assertTrue(new File("target/store-path.xml").exists());
+ }
+
}
Modified: kernel/trunk/exo.kernel.component.common/src/test/resources/conf/=
portal/test-configuration.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/trunk/exo.kernel.component.common/src/test/resources/conf/portal=
/test-configuration.xml 2010-10-07 06:54:54 UTC (rev 3255)
+++ kernel/trunk/exo.kernel.component.common/src/test/resources/conf/portal=
/test-configuration.xml 2010-10-07 07:25:24 UTC (rev 3256)
@@ -52,11 +52,6 @@
=
- org.exoplatform.services.naming.InitialContextBinder
- org.exoplatform.services.naming.InitialContextBinder
-
-
-
org.exoplatform.services.mail.MailService
org.exoplatform.services.mail.impl.MailServiceImpl
@@ -78,6 +73,84 @@
=
+ org.exoplatform.services.naming.InitialContextInitializer
+ org.exoplatform.services.naming.InitialContextInitializer
+
+
+ bind.datasource
+ addPlugin
+ org.exoplatform.services.naming.BindReferencePlugin
+
+
+ bind-name
+ jdbcjcr
+
+
+ class-name
+ javax.sql.DataSource
+
+
+ factory
+ org.apache.commons.dbcp.BasicDataSourceFactory
+
+
+ ref-addresses
+ ref-addresses
+
+
+
+
+
+
+
+
+
+ tx.userTransaction
+ addPlugin
+ org.exoplatform.services.naming.BindReferencePlugin
+
+
+ bind-name
+ UserTransaction
+
+
+ class-name
+ javax.transaction.UserTransaction
+
+
+ factory
+ org.objectweb.jotm.UserTransactionFactory
+
+
+
+ ref-addresses
+ ref-addresses
+
+
+
+
+
+
+ =
+ bindings-store-path =
+ target/store-path.xml =
+ =
+
+ default-properties
+ Default initial context properties
+
+
+
+
+
+
+
+
org.exoplatform.services.scheduler.JobSchedulerService
org.exoplatform.services.scheduler.impl.JobSchedulerServiceImp=
l
--===============2152708465595376496==--
From do-not-reply at jboss.org Thu Oct 7 03:26:21 2010
Content-Type: multipart/mixed; boundary="===============6225629915573661025=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3257 -
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/kernel.
Date: Thu, 07 Oct 2010 03:26:21 -0400
Message-ID: <201010070726.o977QL1l008298@svn01.web.mwc.hst.phx2.redhat.com>
--===============6225629915573661025==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: tolusha
Date: 2010-10-07 03:26:21 -0400 (Thu, 07 Oct 2010)
New Revision: 3257
Modified:
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/=
modules/kernel/initialcontext-binder-service.xml
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/=
modules/kernel/jndi-naming.xml
Log:
EXOJCR-977: support different files for different InitialContextBinder inst=
ances
Modified: jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook=
/en-US/modules/kernel/initialcontext-binder-service.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US=
/modules/kernel/initialcontext-binder-service.xml 2010-10-07 07:25:24 UTC (=
rev 3256)
+++ jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US=
/modules/kernel/initialcontext-binder-service.xml 2010-10-07 07:26:21 UTC (=
rev 3257)
@@ -1,59 +1,47 @@
-
-
-
-
- Initial Context Binder service
-
- Initial Context Binder is responsible for binding references at
- runtime, persisting in file and automatically rebinding after restart. J=
ava
- temp directory is used to persist references in bind-references.xml
- file.
-
-
- Available since Kernel 2.2.1-GA
-
-
-
- API
-
- Service provide methods for binding reference.
-
- public void bind(String bindName, String className, St=
ring factory, String factoryLocation, Map<String, String> refAddr) th=
rows NamingException, FileNotFoundException, XMLStreamExcept
-
-
-
- bindName - name of binding
-
-
-
- className - the fully-qualified name of the class of the obj=
ect
- to which this Reference refers
-
-
-
- factory - the name of the factory class for creating an inst=
ance
- of the object to which this Reference refers
-
-
-
- factoryLocation - the location of the factory class
-
-
-
- refAddr - object's properties map
-
-
-
-
-
- Configuration
-
- A configuration example
-
- <component> =
- <key>org.exoplatform.services.naming.InitialContextBinder</key=
> =
- <type>org.exoplatform.services.naming.InitialContextBinder</ty=
pe> =
-</component>
-
-
+
+
+
+
+
+ Initial Context Binder
+
+ Initial Context Binder is responsible for binding references at
+ runtime, persisting in file and automatically rebinding. Java temp direc=
tory
+ is used to persist references in bind-references.xml file by default. In
+ case when need to definde special file it can be done by add parameter to
+ InitialContextInitializer
+ configuration.
+
+
+ API
+
+ Service provide methods for binding reference.
+
+ public void bind(String bindName, String className, St=
ring factory, String factoryLocation, Map<String, String> refAddr) th=
rows NamingException, FileNotFoundException, XMLStreamExcept
+
+
+
+ bindName - name of binding
+
+
+
+ className - the fully-qualified name of the class of the obj=
ect
+ to which this Reference refers
+
+
+
+ factory - the name of the factory class for creating an inst=
ance
+ of the object to which this Reference refers
+
+
+
+ factoryLocation - the location of the factory class
+
+
+
+ refAddr - object's properties map
+
+
+
+
Modified: jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook=
/en-US/modules/kernel/jndi-naming.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US=
/modules/kernel/jndi-naming.xml 2010-10-07 07:25:24 UTC (rev 3256)
+++ jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US=
/modules/kernel/jndi-naming.xml 2010-10-07 07:26:21 UTC (rev 3257)
@@ -131,9 +131,18 @@
<description>Mandatory initial context properties</descri=
ption>
<property name=3D"java.naming.provider.url" value=3D"rmi://loca=
lhost:9999"/>
</properties-param>
+ <value-param>.
+ <name>bindings-store-path</name>.
+ <value>bind-references.xml</value>.
+ </value-param>.
</init-params>
</component>
=
+ where
+
+ binding-store-path is file pa=
th
+ which stores binded datasources in runtime
+
The BindReferencePlugin component plugin
configuration example (for JDBC datasource):
=
@@ -188,9 +197,7 @@
=
InitialContextInitalizer also provides feature of
references binding in runtime. References have bind in runtime will be
- persisted and automatically rebinded on a next system start. Java temp
- directory is used to persist references in bind-references.xml
- file.
+ persisted and automatically rebinded on a next system start.
=
Service provides methods for binding reference.
=
--===============6225629915573661025==--
From do-not-reply at jboss.org Fri Oct 8 05:07:55 2010
Content-Type: multipart/mixed; boundary="===============3951666028888872128=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3258 - in
jcr/trunk/exo.jcr.component.core:
src/main/java/org/exoplatform/services/jcr/impl/xml/importing and 1 other
directory.
Date: Fri, 08 Oct 2010 05:07:54 -0400
Message-ID: <201010080907.o9897sY9006606@svn01.web.mwc.hst.phx2.redhat.com>
--===============3951666028888872128==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: tolusha
Date: 2010-10-08 05:07:54 -0400 (Fri, 08 Oct 2010)
New Revision: 3258
Modified:
jcr/trunk/exo.jcr.component.core/pom.xml
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/=
jcr/impl/xml/importing/SystemViewImporter.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/=
jcr/impl/xml/importing/WorkspaceContentImporter.java
Log:
EXOJCR-955: NPE when try to import data via WorkspaceContentImporter
Modified: jcr/trunk/exo.jcr.component.core/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/trunk/exo.jcr.component.core/pom.xml 2010-10-07 07:26:21 UTC (rev 3=
257)
+++ jcr/trunk/exo.jcr.component.core/pom.xml 2010-10-08 09:07:54 UTC (rev 3=
258)
@@ -420,7 +420,6 @@
org/exoplatform/services/jcr/**/impl/**/TestDBC=
leanerService.java
org/exoplatform/services/jcr/**/impl/**/TestSav=
eConfiguration.java
org/exoplatform/services/jcr/**/impl/**/ValueSt=
oragePluginTest.java
- org/exoplatform/services/jcr/**/impl/**/TestWor=
kspaceRestore.java
org/exoplatform/services/jcr/**/impl/**/TestSes=
sionCleaner.java
org/exoplatform/services/jcr/**/impl/**/Base*.j=
ava
org/exoplatform/services/jcr/**/impl/**/TestJCR=
SerializationStream.java
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/se=
rvices/jcr/impl/xml/importing/SystemViewImporter.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services=
/jcr/impl/xml/importing/SystemViewImporter.java 2010-10-07 07:26:21 UTC (re=
v 3257)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services=
/jcr/impl/xml/importing/SystemViewImporter.java 2010-10-08 09:07:54 UTC (re=
v 3258)
@@ -18,6 +18,21 @@
*/
package org.exoplatform.services.jcr.impl.xml.importing;
=
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.jcr.NamespaceRegistry;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.ValueFormatException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
+
import org.exoplatform.services.jcr.access.AccessManager;
import org.exoplatform.services.jcr.core.ExtendedPropertyType;
import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
@@ -47,21 +62,6 @@
import org.exoplatform.services.log.Log;
import org.exoplatform.services.security.ConversationState;
=
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.jcr.NamespaceRegistry;
-import javax.jcr.PathNotFoundException;
-import javax.jcr.PropertyType;
-import javax.jcr.RepositoryException;
-import javax.jcr.ValueFormatException;
-import javax.jcr.nodetype.ConstraintViolationException;
-import javax.jcr.nodetype.NoSuchNodeTypeException;
-
/**
* Created by The eXo Platform SAS.
* =
@@ -159,7 +159,7 @@
=
ImportNodeData currentNodeInfo =3D (ImportNodeData)getParent();
=
- NodePropertiesInfo currentNodePropertiesInfo =3D mapNodeProper=
tiesInfo.get(currentNodeInfo.getQPath().getAsString());
+ NodePropertiesInfo currentNodePropertiesInfo =3D mapNodeProper=
tiesInfo.get(currentNodeInfo.getIdentifier());
=
currentNodePropertiesInfo.addProperty(propertyData);
}
@@ -219,7 +219,7 @@
=
changesLog.add(new ItemState(newNodeData, ItemState.ADDED, true, =
getAncestorToSave()));
=
- mapNodePropertiesInfo.put(newNodeData.getQPath().getAsString(), n=
ew NodePropertiesInfo(newNodeData)); =
+ mapNodePropertiesInfo.put(newNodeData.getIdentifier(), new NodePr=
opertiesInfo(newNodeData));
=
tree.push(newNodeData);
=
@@ -307,7 +307,7 @@
{
ImportNodeData currentNodeInfo =3D (ImportNodeData)tree.pop();
=
- NodePropertiesInfo currentNodePropertiesInfo =3D mapNodePropertiesIn=
fo.get(currentNodeInfo.getQPath().getAsString()); =
+ NodePropertiesInfo currentNodePropertiesInfo =3D mapNodePropertiesIn=
fo.get(currentNodeInfo.getIdentifier());
=
if (currentNodePropertiesInfo !=3D null)
{
@@ -571,7 +571,7 @@
=
tree.push(currentNodeInfo);
=
- mapNodePropertiesInfo.put(currentNodeInfo.getQPath().getAsString(), =
new NodePropertiesInfo(currentNodeInfo));
+ mapNodePropertiesInfo.put(currentNodeInfo.getIdentifier(), new NodeP=
ropertiesInfo(currentNodeInfo));
=
return propertyData;
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/se=
rvices/jcr/impl/xml/importing/WorkspaceContentImporter.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services=
/jcr/impl/xml/importing/WorkspaceContentImporter.java 2010-10-07 07:26:21 U=
TC (rev 3257)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services=
/jcr/impl/xml/importing/WorkspaceContentImporter.java 2010-10-08 09:07:54 U=
TC (rev 3258)
@@ -18,6 +18,11 @@
*/
package org.exoplatform.services.jcr.impl.xml.importing;
=
+import java.util.Map;
+
+import javax.jcr.NamespaceRegistry;
+import javax.jcr.RepositoryException;
+
import org.exoplatform.services.jcr.access.AccessControlList;
import org.exoplatform.services.jcr.access.AccessManager;
import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
@@ -35,11 +40,6 @@
import org.exoplatform.services.log.Log;
import org.exoplatform.services.security.ConversationState;
=
-import java.util.Map;
-
-import javax.jcr.NamespaceRegistry;
-import javax.jcr.RepositoryException;
-
/**
* Created by The eXo Platform SAS.
* =
@@ -136,6 +136,8 @@
changesLog.add(new ItemState(newNodeData, ItemState.ADDED, tru=
e, parentData.getQPath()));
}
tree.push(newNodeData);
+
+ mapNodePropertiesInfo.put(newNodeData.getIdentifier(), new NodePr=
opertiesInfo(newNodeData));
}
else
{
--===============3951666028888872128==--
From do-not-reply at jboss.org Fri Oct 8 05:34:36 2010
Content-Type: multipart/mixed; boundary="===============1329559245272093675=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3259 - in
jcr/branches/1.12.x/exo.jcr.component.core:
src/main/java/org/exoplatform/services/jcr/impl/xml/importing and 1 other
directory.
Date: Fri, 08 Oct 2010 05:34:36 -0400
Message-ID: <201010080934.o989Yasa007269@svn01.web.mwc.hst.phx2.redhat.com>
--===============1329559245272093675==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: tolusha
Date: 2010-10-08 05:34:35 -0400 (Fri, 08 Oct 2010)
New Revision: 3259
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/pom.xml
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform=
/services/jcr/impl/xml/importing/SystemViewImporter.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform=
/services/jcr/impl/xml/importing/WorkspaceContentImporter.java
Log:
EXOJCR-955: NPE when try to import data via WorkspaceContentImporter
Modified: jcr/branches/1.12.x/exo.jcr.component.core/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.component.core/pom.xml 2010-10-08 09:07:54 =
UTC (rev 3258)
+++ jcr/branches/1.12.x/exo.jcr.component.core/pom.xml 2010-10-08 09:34:35 =
UTC (rev 3259)
@@ -409,7 +409,6 @@
org/exoplatform/services/jcr/**/impl/**/TestRep=
ositoryManagement.java
org/exoplatform/services/jcr/**/impl/**/TestSav=
eConfiguration.java
org/exoplatform/services/jcr/**/impl/**/ValueSt=
oragePluginTest.java
- org/exoplatform/services/jcr/**/impl/**/TestWor=
kspaceRestore.java
org/exoplatform/services/jcr/**/impl/**/TestSes=
sionCleaner.java
org/exoplatform/services/jcr/**/impl/**/Base*.j=
ava
org/exoplatform/services/jcr/**/impl/**/TestJCR=
SerializationStream.java
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exop=
latform/services/jcr/impl/xml/importing/SystemViewImporter.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatfor=
m/services/jcr/impl/xml/importing/SystemViewImporter.java 2010-10-08 09:07:=
54 UTC (rev 3258)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatfor=
m/services/jcr/impl/xml/importing/SystemViewImporter.java 2010-10-08 09:34:=
35 UTC (rev 3259)
@@ -18,21 +18,6 @@
*/
package org.exoplatform.services.jcr.impl.xml.importing;
=
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.jcr.NamespaceRegistry;
-import javax.jcr.PathNotFoundException;
-import javax.jcr.PropertyType;
-import javax.jcr.RepositoryException;
-import javax.jcr.ValueFormatException;
-import javax.jcr.nodetype.ConstraintViolationException;
-import javax.jcr.nodetype.NoSuchNodeTypeException;
-
import org.exoplatform.services.jcr.access.AccessManager;
import org.exoplatform.services.jcr.core.ExtendedPropertyType;
import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
@@ -62,6 +47,21 @@
import org.exoplatform.services.log.Log;
import org.exoplatform.services.security.ConversationState;
=
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.jcr.NamespaceRegistry;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.ValueFormatException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
+
/**
* Created by The eXo Platform SAS.
* =
@@ -159,7 +159,7 @@
=
ImportNodeData currentNodeInfo =3D (ImportNodeData)getParent();
=
- NodePropertiesInfo currentNodePropertiesInfo =3D mapNodeProper=
tiesInfo.get(currentNodeInfo.getQPath().getAsString());
+ NodePropertiesInfo currentNodePropertiesInfo =3D mapNodeProper=
tiesInfo.get(currentNodeInfo.getIdentifier());
=
currentNodePropertiesInfo.addProperty(propertyData);
} =
@@ -219,7 +219,7 @@
=
changesLog.add(new ItemState(newNodeData, ItemState.ADDED, true, =
getAncestorToSave()));
=
- mapNodePropertiesInfo.put(newNodeData.getQPath().getAsString(), n=
ew NodePropertiesInfo(newNodeData)); =
+ mapNodePropertiesInfo.put(newNodeData.getIdentifier(), new NodePr=
opertiesInfo(newNodeData));
=
tree.push(newNodeData);
=
@@ -307,14 +307,14 @@
{
ImportNodeData currentNodeInfo =3D (ImportNodeData)tree.pop();
=
- NodePropertiesInfo currentNodePropertiesInfo =3D mapNodePropertiesIn=
fo.get(currentNodeInfo.getQPath().getAsString()); =
+ NodePropertiesInfo currentNodePropertiesInfo =3D mapNodePropertiesIn=
fo.get(currentNodeInfo.getIdentifier());
=
if (currentNodePropertiesInfo !=3D null)
{
checkProperties(currentNodePropertiesInfo);
}
=
- mapNodePropertiesInfo.remove(currentNodeInfo.getQPath().getAsString(=
));
+ mapNodePropertiesInfo.remove(currentNodeInfo.getIdentifier());
=
currentNodeInfo.setMixinTypeNames(currentNodeInfo.getMixinTypeNames(=
));
=
@@ -567,8 +567,8 @@
=
tree.push(currentNodeInfo);
=
- mapNodePropertiesInfo.put(currentNodeInfo.getQPath().getAsString(), =
new NodePropertiesInfo(currentNodeInfo));
- =
+ mapNodePropertiesInfo.put(currentNodeInfo.getIdentifier(), new NodeP=
ropertiesInfo(currentNodeInfo));
+
return propertyData;
}
=
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exop=
latform/services/jcr/impl/xml/importing/WorkspaceContentImporter.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatfor=
m/services/jcr/impl/xml/importing/WorkspaceContentImporter.java 2010-10-08 =
09:07:54 UTC (rev 3258)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatfor=
m/services/jcr/impl/xml/importing/WorkspaceContentImporter.java 2010-10-08 =
09:34:35 UTC (rev 3259)
@@ -18,6 +18,11 @@
*/
package org.exoplatform.services.jcr.impl.xml.importing;
=
+import java.util.Map;
+
+import javax.jcr.NamespaceRegistry;
+import javax.jcr.RepositoryException;
+
import org.exoplatform.services.jcr.access.AccessControlList;
import org.exoplatform.services.jcr.access.AccessManager;
import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
@@ -35,11 +40,6 @@
import org.exoplatform.services.log.Log;
import org.exoplatform.services.security.ConversationState;
=
-import java.util.Map;
-
-import javax.jcr.NamespaceRegistry;
-import javax.jcr.RepositoryException;
-
/**
* Created by The eXo Platform SAS.
* =
@@ -136,6 +136,8 @@
changesLog.add(new ItemState(newNodeData, ItemState.ADDED, tru=
e, parentData.getQPath()));
}
tree.push(newNodeData);
+
+ mapNodePropertiesInfo.put(newNodeData.getIdentifier(), new NodePr=
opertiesInfo(newNodeData));
}
else
{
--===============1329559245272093675==--
From do-not-reply at jboss.org Fri Oct 8 06:07:12 2010
Content-Type: multipart/mixed; boundary="===============2342362881045390929=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3260 -
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing.
Date: Fri, 08 Oct 2010 06:07:12 -0400
Message-ID: <201010081007.o98A7CBq014693@svn01.web.mwc.hst.phx2.redhat.com>
--===============2342362881045390929==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: tolusha
Date: 2010-10-08 06:07:12 -0400 (Fri, 08 Oct 2010)
New Revision: 3260
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/=
jcr/impl/xml/importing/SystemViewImporter.java
Log:
EXOJCR-955: NPE when try to import data via WorkspaceContentImporter
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/se=
rvices/jcr/impl/xml/importing/SystemViewImporter.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services=
/jcr/impl/xml/importing/SystemViewImporter.java 2010-10-08 09:34:35 UTC (re=
v 3259)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services=
/jcr/impl/xml/importing/SystemViewImporter.java 2010-10-08 10:07:12 UTC (re=
v 3260)
@@ -314,7 +314,7 @@
checkProperties(currentNodePropertiesInfo);
}
=
- mapNodePropertiesInfo.remove(currentNodeInfo.getQPath().getAsString(=
));
+ mapNodePropertiesInfo.remove(currentNodeInfo.getIdentifier());
=
currentNodeInfo.setMixinTypeNames(currentNodeInfo.getMixinTypeNames(=
));
=
--===============2342362881045390929==--
From do-not-reply at jboss.org Fri Oct 8 07:45:06 2010
Content-Type: multipart/mixed; boundary="===============2887051186280654110=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3261 -
kernel/branches/2.2.x/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils.
Date: Fri, 08 Oct 2010 07:45:06 -0400
Message-ID: <201010081145.o98Bj6Vj025491@svn01.web.mwc.hst.phx2.redhat.com>
--===============2887051186280654110==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: sergiykarpenko
Date: 2010-10-08 07:45:06 -0400 (Fri, 08 Oct 2010)
New Revision: 3261
Modified:
kernel/branches/2.2.x/exo.kernel.commons/src/main/java/org/exoplatform/c=
ommons/utils/MapResourceBundle.java
kernel/branches/2.2.x/exo.kernel.commons/src/main/java/org/exoplatform/c=
ommons/utils/QName.java
Log:
JCR-1473:merge performance improvements
Modified: kernel/branches/2.2.x/exo.kernel.commons/src/main/java/org/exopla=
tform/commons/utils/MapResourceBundle.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/branches/2.2.x/exo.kernel.commons/src/main/java/org/exoplatform/=
commons/utils/MapResourceBundle.java 2010-10-08 10:07:12 UTC (rev 3260)
+++ kernel/branches/2.2.x/exo.kernel.commons/src/main/java/org/exoplatform/=
commons/utils/MapResourceBundle.java 2010-10-08 11:45:06 UTC (rev 3261)
@@ -25,8 +25,6 @@
import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;
-import java.util.Set;
-import java.util.Vector;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
=
@@ -36,41 +34,43 @@
public class MapResourceBundle extends ResourceBundle implements Serializa=
ble
{
=
- private final static String REGEXP =3D "#\\{.*\\}";
+ private final static Pattern PATTERN =3D Pattern.compile("#\\{.*\\}");
=
- private Map props =3D new HashMap();
+ private Map props;
=
private Locale locale;
=
public MapResourceBundle(Locale l)
{
this.locale =3D l;
+ this.props =3D new HashMap();
}
=
public MapResourceBundle(ResourceBundle rB, Locale l)
{
+ Map props =3D new HashMap();
+ doMerge(props, rB);
+
+ //
this.locale =3D l;
- initMap(rB);
+ this.props =3D props;
}
=
- private void initMap(ResourceBundle rB)
+ private static void doMerge(Map props, ResourceBundle r=
B)
{
- Enumeration e =3D rB.getKeys();
+ Enumeration e =3D rB.getKeys();
while (e.hasMoreElements())
{
- String s =3D (String)e.nextElement();
- try
+ String key =3D e.nextElement();
+ if (props.get(key) =3D=3D null)
{
- if (props.get(s) =3D=3D null)
+ Object o =3D rB.getObject(key);
+ if (o instanceof String)
{
- String[] newArray =3D rB.getStringArray(s);
- props.put(s, newArray);
+ String value =3D (String)o;
+ props.put(key.intern(), value.intern());
}
}
- catch (ClassCastException ex)
- {
- props.put(s, rB.getObject(s));
- }
}
}
=
@@ -79,9 +79,20 @@
return props.get(key);
}
=
- public Enumeration getKeys()
+ public Enumeration getKeys()
{
- return new Vector(props.keySet()).elements();
+ final Iterator i =3D props.keySet().iterator();
+ return new Enumeration()
+ {
+ public boolean hasMoreElements()
+ {
+ return i.hasNext();
+ }
+ public String nextElement()
+ {
+ return i.next();
+ }
+ };
}
=
public Locale getLocale()
@@ -89,69 +100,63 @@
return this.locale;
}
=
- public void add(String key, Object value)
+ public void add(String key, Object o)
{
- props.put(key, value);
+ if (key !=3D null && o instanceof String)
+ {
+ String value =3D (String)o;
+ props.put(key.intern(), value.intern());
+ }
}
=
public void remove(String key)
{
- props.remove(key);
+ if (key !=3D null)
+ {
+ props.remove(key);
+ }
}
=
public void merge(ResourceBundle bundle)
{
- Enumeration e =3D bundle.getKeys();
- while (e.hasMoreElements())
- {
- String s =3D (String)e.nextElement();
- Object value =3D bundle.getObject(s);
- try
- {
- String[] newArray =3D bundle.getStringArray(s);
- if (props.get(s) =3D=3D null)
- {
- props.put(s, newArray);
- }
- }
- catch (ClassCastException ex)
- {
- props.put(s, value);
- }
- }
+ doMerge(props, bundle);
}
=
public void resolveDependencies()
{
- Map tempMap =3D new HashMap();
- Set keys =3D props.keySet();
- Pattern pattern =3D Pattern.compile(REGEXP);
- for (Iterator iter =3D keys.iterator(); iter.hasNext();)
+ Map tempMap =3D new HashMap();
+ for (String element : props.keySet())
{
- String element =3D (String)iter.next();
- String value =3D lookupKey(element, pattern);
- tempMap.put(element, value);
+ String value =3D lookupKey(element);
+ if (value !=3D null)
+ {
+ tempMap.put(element.intern(), value.intern());
+ }
}
props =3D tempMap;
}
=
- private String lookupKey(String key, Pattern pattern)
+ private String lookupKey(String key)
{
- String s =3D (String)props.get(key);
+ String s =3D props.get(key);
if (s =3D=3D null)
+ {
return key;
- Matcher matcher =3D pattern.matcher(s);
+ }
+
+ //
+ Matcher matcher =3D PATTERN.matcher(s);
if (matcher.find())
{
- return recursivedResolving(s, pattern);
+ return recursivedResolving(s);
}
return s;
}
=
- private String recursivedResolving(String key, Pattern pattern)
+ private String recursivedResolving(String key)
{
String resolved =3D key;
- StringBuffer sB =3D new StringBuffer();
+ StringBuilder sB =3D new StringBuilder();
while (resolved.indexOf("#{") !=3D -1)
{
sB.setLength(0);
@@ -159,7 +164,7 @@
int lastIndex =3D resolved.indexOf('}', firstIndex);
String realKey =3D resolved.substring(firstIndex + 2, lastIndex);
sB.append(resolved.substring(0, firstIndex));
- sB.append(lookupKey(realKey, pattern));
+ sB.append(lookupKey(realKey));
sB.append(resolved.substring(lastIndex + 1));
resolved =3D sB.toString();
}
Modified: kernel/branches/2.2.x/exo.kernel.commons/src/main/java/org/exopla=
tform/commons/utils/QName.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/branches/2.2.x/exo.kernel.commons/src/main/java/org/exoplatform/=
commons/utils/QName.java 2010-10-08 10:07:12 UTC (rev 3260)
+++ kernel/branches/2.2.x/exo.kernel.commons/src/main/java/org/exoplatform/=
commons/utils/QName.java 2010-10-08 11:45:06 UTC (rev 3261)
@@ -37,14 +37,23 @@
protected final int hashCode;
=
public QName(String namespace, String name)
- {
- this.namespace =3D (namespace !=3D null ? namespace : "").intern();
- this.name =3D (name !=3D null ? name : "");
-
- this.stringName =3D ("[" + this.namespace + "]" + this.name);
-
- int hk =3D 31 + this.namespace.hashCode();
- this.hashCode =3D hk * 31 + this.name.hashCode();
+ { =
+ if (namespace =3D=3D null) =
+ {
+ namespace =3D "";
+ }
+ if (name =3D=3D null)
+ {
+ name =3D "";
+ } =
+ String stringName =3D ("[" + namespace + "]" + name);
+ int hashCode =3D (31 + namespace.hashCode()) * 31 + name.hashCode();
+ =
+ // =
+ this.namespace =3D namespace;
+ this.name =3D name;
+ this.stringName =3D stringName;
+ this.hashCode =3D hashCode;
}
=
public String getNamespace()
--===============2887051186280654110==--
From do-not-reply at jboss.org Fri Oct 8 08:04:25 2010
Content-Type: multipart/mixed; boundary="===============9037778074661195710=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3262 - in
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr:
impl/core and 1 other directory.
Date: Fri, 08 Oct 2010 08:04:25 -0400
Message-ID: <201010081204.o98C4Pfc031968@svn01.web.mwc.hst.phx2.redhat.com>
--===============9037778074661195710==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: sergiykarpenko
Date: 2010-10-08 08:04:24 -0400 (Fri, 08 Oct 2010)
New Revision: 3262
Added:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform=
/services/jcr/impl/core/JCRPathExt.java
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform=
/services/jcr/datamodel/InternalQName.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform=
/services/jcr/datamodel/QPathEntry.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform=
/services/jcr/impl/core/JCRName.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform=
/services/jcr/impl/core/JCRPath.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform=
/services/jcr/impl/core/LocationFactory.java
Log:
JCR-1473: merge performance improvements
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exop=
latform/services/jcr/datamodel/InternalQName.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatfor=
m/services/jcr/datamodel/InternalQName.java 2010-10-08 11:45:06 UTC (rev 32=
61)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatfor=
m/services/jcr/datamodel/InternalQName.java 2010-10-08 12:04:24 UTC (rev 32=
62)
@@ -32,7 +32,7 @@
=
/**
* InternalQName constructor.
- * =
+ *
* @param namespace
* - namespace URI
* @param name
@@ -79,9 +79,18 @@
if (o =3D=3D null)
return false;
=
- if (!(o instanceof InternalQName))
- return false;
+ if (o instanceof InternalQName)
+ {
+ InternalQName that =3D (InternalQName)o;
+ if (hashCode =3D=3D that.hashCode)
+ {
+ String s1 =3D getAsString();
+ String s2 =3D that.getAsString();
+ return s1.equals(s2);
+ }
+ }
=
- return hashCode =3D=3D o.hashCode() && getAsString().equals(((QName)=
o).getAsString());
+ return false;
+
}
}
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exop=
latform/services/jcr/datamodel/QPathEntry.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatfor=
m/services/jcr/datamodel/QPathEntry.java 2010-10-08 11:45:06 UTC (rev 3261)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatfor=
m/services/jcr/datamodel/QPathEntry.java 2010-10-08 12:04:24 UTC (rev 3262)
@@ -32,6 +32,10 @@
*/
private final int index;
=
+ private String cachedToString;
+
+ private String cachedToStringShowIndex;
+
/**
* QPathEntry constructor.
* =
@@ -128,7 +132,44 @@
*/
public String getAsString(boolean showIndex)
{
- return super.getAsString() + (showIndex ? QPath.PREFIX_DELIMITER + t=
his.index : "");
+ if (showIndex)
+ {
+ if (cachedToStringShowIndex !=3D null)
+ {
+ return cachedToStringShowIndex;
+ }
+ }
+ else
+ {
+ if (cachedToString !=3D null)
+ {
+ return cachedToString;
+ }
+ }
+
+ //
+ String res;
+ if (showIndex)
+ {
+ res =3D super.getAsString() + QPath.PREFIX_DELIMITER + this.index;
+ }
+ else
+ {
+ res =3D super.getAsString();
+ }
+
+ //
+ if (showIndex)
+ {
+ cachedToStringShowIndex =3D res;
+ }
+ else
+ {
+ cachedToString =3D res;
+ }
+
+ //
+ return res;
}
=
/**
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exop=
latform/services/jcr/impl/core/JCRName.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatfor=
m/services/jcr/impl/core/JCRName.java 2010-10-08 11:45:06 UTC (rev 3261)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatfor=
m/services/jcr/impl/core/JCRName.java 2010-10-08 12:04:24 UTC (rev 3262)
@@ -40,17 +40,43 @@
=
protected final int hashCode;
=
+ protected JCRName(InternalQName qname, String prefix)
+ {
+ this(qname.getNamespace(), qname.getName(), prefix);
+ }
+
+ JCRName(JCRPath.PathElement that)
+ {
+ this.prefix =3D that.prefix;
+ this.name =3D that.name;
+ this.namespace =3D that.namespace;
+ this.stringName =3D that.stringName;
+ this.hashCode =3D that.hashCode;
+ }
+
JCRName(String namespace, String name, String prefix)
{
- this.name =3D name.intern();
- this.namespace =3D namespace.intern();
- this.prefix =3D prefix.intern();
+ int hk =3D 31 + namespace.hashCode();
+ hk =3D hk * 31 + name.hashCode();
+ int hashCode =3D hk * 31 + prefix.hashCode();
=
- this.stringName =3D ((this.prefix.length() =3D=3D 0 ? "" : this.pref=
ix + ":") + this.name);
+ //
+ String stringName;
+ if (prefix.length() =3D=3D 0)
+ {
+ stringName =3D name;
+ }
+ else
+ {
+ stringName =3D prefix + ":" + name;
+ }
=
- int hk =3D 31 + this.namespace.hashCode();
- hk =3D hk * 31 + this.name.hashCode();
- this.hashCode =3D hk * 31 + this.prefix.hashCode();
+ //
+ this.name =3D name;
+ this.namespace =3D namespace;
+ this.prefix =3D prefix;
+ this.stringName =3D stringName;
+ this.hashCode =3D hashCode;
}
=
/**
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exop=
latform/services/jcr/impl/core/JCRPath.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatfor=
m/services/jcr/impl/core/JCRPath.java 2010-10-08 11:45:06 UTC (rev 3261)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatfor=
m/services/jcr/impl/core/JCRPath.java 2010-10-08 12:04:24 UTC (rev 3262)
@@ -18,16 +18,15 @@
*/
package org.exoplatform.services.jcr.impl.core;
=
+import org.exoplatform.services.jcr.core.NamespaceAccessor;
+import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
-import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
=
-import java.util.ArrayList;
+import javax.jcr.RepositoryException;
=
-import javax.jcr.PathNotFoundException;
-
/**
* Created by The eXo Platform SAS.
* =
@@ -35,7 +34,7 @@
* @version $Id: JCRPath.java 11907 2008-03-13 15:36:21Z ksm $
*/
=
-public class JCRPath
+public abstract class JCRPath
{
=
public final static String ROOT_PATH =3D "/";
@@ -48,250 +47,117 @@
=
protected static Log log =3D ExoLogger.getLogger("exo.jcr.component.cor=
e.JCRPath");
=
- protected PathElement[] names;
-
- JCRPath()
+ public static JCRPath createJCRPath()
{
- this.names =3D new PathElement[0];
+ return JCRPathExt.ROOT;
}
=
- public boolean isAbsolute()
+ public static JCRPath createJCRPath(NamespaceAccessor namespaces, QPath=
qpath) throws RepositoryException
{
- if (names.length > 0)
- {
- PathElement first =3D names[0];
- if (first.getName().equals(ROOT_NAME))
- {
- return true;
- }
- }
- return false;
+ return new JCRPathExt(namespaces, qpath.getEntries());
}
=
- JCRPath addEntry(String namespace, String name, String prefix, int inde=
x)
+ public static JCRPath createJCRPath(NamespaceAccessor namespaces, QPath=
Entry[] relPath) throws RepositoryException
{
- if (name.equals(THIS_RELPATH))
- return this;
-
- if (name.equals(PARENT_RELPATH))
- {
- return addEntry(new MoveUpElement());
- }
-
- return addEntry(new PathElement(namespace, name, prefix, index));
+ return new JCRPathExt(namespaces, relPath);
}
=
- JCRPath addEntry(PathElement entry)
- {
- if (names.length > 0 && entry instanceof MoveUpElement && !(names[na=
mes.length - 1] instanceof MoveUpElement))
- {
- return removeLastEntry();
- }
+ public abstract boolean isAbsolute();
=
- PathElement[] newNames =3D new PathElement[names.length + 1];
- for (int i =3D 0; i < names.length; i++)
- newNames[i] =3D names[i];
- newNames[names.length] =3D entry;
- names =3D newNames;
- return this;
- }
+ abstract JCRPath addEntry(String namespace, String name, String prefix,=
int index);
=
- JCRPath removeLastEntry()
- {
+ abstract JCRPath addEntry(PathElement entry);
=
- if (names.length <=3D 0)
- {
- log.warn("Wrong relative path. Can't move up in path hierarhy. " =
+ getAsString(true));
- return this;
- }
+ abstract JCRPath add(JCRPath path);
=
- PathElement[] newNames =3D new PathElement[names.length - 1];
- for (int i =3D 0; i < newNames.length; i++)
- newNames[i] =3D names[i];
- names =3D newNames;
- return this;
- }
+ abstract JCRPath addEntries(PathElement... entries);
=
- public JCRPath makeParentPath()
- {
- return makeAncestorPath(1);
- }
+ public abstract JCRPath makeParentPath();
=
- /**
- * Makes ancestor path by relative degree (For ex relativeDegree =3D=3D=
1 means parent path etc)
- * =
- * @param relativeDegree
- * @return
- * @throws PathNotFoundException
- */
- public JCRPath makeAncestorPath(int relativeDegree)
- {
+ public abstract JCRPath makeAncestorPath(int relativeDegree);
=
- JCRPath path =3D new JCRPath();
- for (int i =3D 0; i < names.length - relativeDegree; i++)
- path.addEntry(names[i]);
- return path;
- }
+ public abstract PathElement[] getRelPath(int relativeDegree);
=
- public PathElement[] getRelPath(int relativeDegree)
- {
- ArrayList entries =3D new ArrayList();
- for (int i =3D names.length - relativeDegree; i < names.length; i++)
- entries.add(names[i]);
- PathElement[] relPath =3D new PathElement[entries.size()];
- for (int i =3D 0; i < relPath.length; i++)
- relPath[i] =3D entries.get(i);
- return relPath;
- }
+ public abstract QPath getInternalPath();
=
- public QPath getInternalPath()
- {
+ public abstract String getAsString(boolean showIndex);
=
- QPathEntry[] entries =3D new QPathEntry[names.length];
+ public abstract int getDepth();
=
- for (int i =3D 0; i < names.length; i++)
- entries[i] =3D new QPathEntry(names[i].getNamespace(), names[i].g=
etName(), names[i].getIndex());
+ public abstract int getLength();
=
- QPath qpath =3D new QPath(entries);
- return qpath;
- }
+ public abstract PathElement getEntry(int index);
=
- public String getAsString(boolean showIndex)
- {
+ public abstract PathElement[] getEntries();
=
- // [PN] 27.06.07
- String path =3D "";
- if (isAbsolute())
- {
- if (size() =3D=3D 1)
- return "/";
+ public abstract boolean isDescendantOf(JCRPath ancestorLocation, boolea=
n childOnly);
=
- for (int i =3D 1; i < names.length; i++)
- {
- path +=3D "/" + names[i].getAsString(showIndex);
- }
- }
- else
- {
- // relative
- for (int i =3D 0; i < names.length; i++)
- {
- path +=3D i > 0 ? "/" + names[i].getAsString(showIndex) : name=
s[i].getAsString(showIndex);
- }
- }
+ public abstract boolean isAncestorOf(JCRPath descendantLocation, boolea=
n childOnly);
=
- return path;
- }
+ public abstract PathElement getName();
=
- public int getDepth()
- {
- return size() - 1;
- }
+ public abstract int getIndex();
=
- public boolean isDescendantOf(JCRPath ancestorLocation, boolean childOn=
ly)
- {
- int depthDiff =3D getDepth() - ancestorLocation.getDepth();
- if (depthDiff <=3D 0 || (childOnly && depthDiff !=3D 1))
- return false;
+ public abstract boolean isIndexSetExplicitly();
=
- JCRPath.PathElement[] anotherNames =3D ancestorLocation.getEntries();
- for (int i =3D 0; i < anotherNames.length; i++)
- {
- boolean result =3D anotherNames[i].equals(names[i]);
- if (!result)
- return false;
- }
- return true;
- }
+ public abstract boolean isSameNameSibling(JCRPath anotherPath);
=
- public boolean isAncestorOf(JCRPath descendantLocation, boolean childOn=
ly)
- {
- return descendantLocation.isDescendantOf(this, childOnly);
- }
+ public abstract boolean equals(Object obj);
=
- private int size()
+ protected JCRPath()
{
- return names.length;
}
=
- public JCRName getName()
+ public static class PathElement extends JCRName
{
- if (size() > 0)
- return names[size() - 1];
=
- return new ThisElement();
- }
+ private final int index;
=
- public int getIndex()
- {
- return names[size() - 1].getIndex();
- }
+ private final boolean indexSetExplicitly;
=
- public boolean isIndexSetExplicitly()
- {
- return names[size() - 1].isIndexSetExplicitly();
- }
+ private String cachedToString;
=
- public boolean isSameNameSibling(JCRPath anotherPath)
- {
- JCRName[] anotherNames =3D anotherPath.getEntries();
- for (int i =3D 0; i < anotherNames.length - 1; i++)
- {
- boolean result =3D anotherNames[i].equals(names[i]);
- if (!result)
- return false;
- }
- return getName().getName().equals(anotherPath.getName().getName())
- && this.getName().getPrefix().equals(anotherPath.getName().getPre=
fix());
- }
+ private String cachedToStringShowIndex;
=
- public boolean equals(Object obj)
- {
- if (this =3D=3D obj)
+ public PathElement(String namespace, String name, String prefix, int=
index)
{
- return true;
- }
- if (obj instanceof JCRPath)
- {
- JCRPath other =3D (JCRPath)obj;
- return this.getInternalPath().equals(other.getInternalPath());
- }
- return false;
- }
+ super(namespace, name, prefix);
=
- PathElement[] getEntries()
- {
- return names;
- }
-
- public class ThisElement extends PathElement
- {
-
- ThisElement()
- {
- super(Constants.NS_DEFAULT_URI, THIS_RELPATH, Constants.NS_EMPTY_=
PREFIX, -1);
+ //
+ if (index =3D=3D -1)
+ {
+ this.index =3D 1;
+ this.indexSetExplicitly =3D false;
+ }
+ else
+ {
+ this.index =3D index;
+ this.indexSetExplicitly =3D true;
+ }
}
- }
=
- public class MoveUpElement extends PathElement
- {
-
- MoveUpElement()
+ public PathElement(InternalQName qname, String prefix, int index)
{
- super(Constants.NS_DEFAULT_URI, PARENT_RELPATH, Constants.NS_EMPT=
Y_PREFIX, -1);
+ super(qname, prefix);
+
+ //
+ if (index =3D=3D -1)
+ {
+ this.index =3D 1;
+ this.indexSetExplicitly =3D false;
+ }
+ else
+ {
+ this.index =3D index;
+ this.indexSetExplicitly =3D true;
+ }
}
- }
=
- public class PathElement extends JCRName
- {
-
- private final int index;
-
- private final boolean indexSetExplicitly;
-
- public PathElement(String namespace, String name, String prefix, int=
index)
+ public PathElement(PathElement that, int index)
{
- super(namespace, name, prefix);
+ super(that);
+
+ //
if (index =3D=3D -1)
{
this.index =3D 1;
@@ -306,7 +172,7 @@
=
public PathElement clone(int newIndex)
{
- return new PathElement(this.namespace, this.name, this.prefix, ne=
wIndex);
+ return new PathElement(this, newIndex);
}
=
public int getIndex()
@@ -324,12 +190,38 @@
=
public String getAsString(boolean showIndex)
{
- String indexStr;
+ if (showIndex)
+ {
+ if (cachedToStringShowIndex !=3D null)
+ {
+ return cachedToStringShowIndex;
+ }
+ }
+ else
+ {
+ if (cachedToString !=3D null)
+ {
+ return cachedToString;
+ }
+ }
+
+ StringBuffer sb =3D new StringBuffer(super.getAsString());
if (showIndex || getIndex() > 1)
- indexStr =3D "[" + getIndex() + "]";
+ sb.append("[").append(index).append("]");
+ String res =3D sb.toString();
+
+ //
+ if (showIndex)
+ {
+ cachedToStringShowIndex =3D res;
+ }
else
- indexStr =3D "";
- return (super.getAsString() + indexStr);
+ {
+ cachedToString =3D res;
+ }
+
+ //
+ return res;
}
=
public boolean isIndexSetExplicitly()
@@ -337,5 +229,4 @@
return indexSetExplicitly;
}
}
-
}
Added: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplat=
form/services/jcr/impl/core/JCRPathExt.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatfor=
m/services/jcr/impl/core/JCRPathExt.java (rev 0)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatfor=
m/services/jcr/impl/core/JCRPathExt.java 2010-10-08 12:04:24 UTC (rev 3262)
@@ -0,0 +1,394 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.impl.core;
+
+import org.exoplatform.services.jcr.core.NamespaceAccessor;
+import org.exoplatform.services.jcr.datamodel.InternalQName;
+import org.exoplatform.services.jcr.datamodel.QPath;
+import org.exoplatform.services.jcr.datamodel.QPathEntry;
+import org.exoplatform.services.jcr.impl.Constants;
+
+import javax.jcr.RepositoryException;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * @author Gennady Azarenk=
ov
+ * @version $Id: JCRPath.java 11907 2008-03-13 15:36:21Z ksm $
+ */
+
+public class JCRPathExt extends JCRPath
+{
+
+ private static PathElement[] EMPTY_PATH =3D new PathElement[0];
+
+ private static final PathElement THIS_ELEMENT =3D new PathElement(Const=
ants.NS_DEFAULT_URI, THIS_RELPATH, Constants.NS_EMPTY_PREFIX, -1);
+
+ private static final PathElement MOVE_UP_ELEMENT =3D new PathElement(Co=
nstants.NS_DEFAULT_URI, PARENT_RELPATH, Constants.NS_EMPTY_PREFIX, -1);
+
+ protected final PathElement[] names;
+
+ protected final int size;
+
+ protected String cachedToString;
+
+ protected String cachedToStringShowIndex;
+
+ protected QPath cachedInternalQPath;
+
+ public final static JCRPathExt ROOT =3D new JCRPathExt();
+
+ private JCRPathExt()
+ {
+ this(EMPTY_PATH);
+ }
+
+ JCRPathExt(NamespaceAccessor namespaces, QPathEntry[] path) throws Repo=
sitoryException
+ {
+ PathElement[] names =3D new PathElement[path.length];
+ int size =3D 0;
+ for (QPathEntry entry : path)
+ {
+ String prefix =3D namespaces.getNamespacePrefixByURI(entry.getNam=
espace());
+ PathElement element =3D element(entry.getNamespace(), entry.getNa=
me(), prefix, entry.getIndex());
+ size =3D addEntry(names, size, element);
+ }
+
+ //
+ this.names =3D names;
+ this.size =3D size;
+ }
+
+ JCRPathExt(JCRPathExt that, PathElement[] addedEntries, int addedSize)
+ {
+ PathElement[] names =3D new PathElement[that.size + addedSize];
+ int size =3D 0;
+ for (int i =3D 0;i < that.size;i++)
+ {
+ size =3D addEntry(names, size, that.names[i]);
+ }
+ for (int i =3D 0;i < addedSize;i++)
+ {
+ size =3D addEntry(names, size, addedEntries[i]);
+ }
+
+ //
+ this.names =3D names;
+ this.size =3D size;
+ }
+
+ JCRPathExt(PathElement[] names)
+ {
+ this(names, names.length);
+ }
+
+ JCRPathExt(PathElement[] names, int size)
+ {
+ if (size < 0)
+ {
+ throw new AssertionError("Size value is negative: " + size);
+ }
+ if (size > names.length)
+ {
+ throw new AssertionError("Size value is too large: " + size + " i=
nstead of max: " + names.length);
+ }
+
+ //
+ this.names =3D names;
+ this.size =3D size;
+ }
+
+ public boolean isAbsolute()
+ {
+ if (size > 0)
+ {
+ PathElement first =3D names[0];
+ if (first.getName().equals(ROOT_NAME))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ JCRPath add(JCRPath path)
+ {
+ return new JCRPathExt(this, ((JCRPathExt)path).names, ((JCRPathExt)p=
ath).size);
+ }
+
+ @Override
+ JCRPath addEntries(PathElement... entries)
+ {
+ return new JCRPathExt(this, entries, entries.length);
+ }
+
+ JCRPathExt addEntry(String namespace, String name, String prefix, int i=
ndex)
+ {
+ return addEntry(element(namespace, name, prefix, index));
+ }
+
+ public JCRPathExt makeAncestorPath(int relativeDegree)
+ {
+ return new JCRPathExt(names, size - relativeDegree);
+ }
+
+ JCRPathExt addEntry(PathElement entry)
+ {
+ return new JCRPathExt(this, new PathElement[]{entry}, 1);
+ }
+
+ private static PathElement element(String namespace, String name, Strin=
g prefix, int index)
+ {
+ if (name.equals(THIS_RELPATH))
+ {
+ return THIS_ELEMENT;
+ }
+ else if (name.equals(PARENT_RELPATH))
+ {
+ return MOVE_UP_ELEMENT;
+ }
+ else
+ {
+ return new PathElement(namespace, name, prefix, index);
+ }
+ }
+
+ private static int addEntry(PathElement[] entries, int size, PathElemen=
t entry)
+ {
+ if (entry =3D=3D THIS_ELEMENT)
+ {
+ return size;
+ }
+ if (size > 0 && entry =3D=3D MOVE_UP_ELEMENT && !(entries[size - 1] =
=3D=3D MOVE_UP_ELEMENT))
+ {
+ if (size <=3D 0)
+ {
+ log.warn("Wrong relative path. Can't move up in path hierarhy.=
");
+ return 0;
+ }
+ return size - 1;
+ }
+
+ //
+ entries[size] =3D entry;
+
+ //
+ return size + 1;
+ }
+
+ public JCRPathExt makeParentPath()
+ {
+ return makeAncestorPath(1);
+ }
+
+ @Override
+ public int getLength()
+ {
+ return size;
+ }
+
+ @Override
+ public PathElement getEntry(int index)
+ {
+ if (index > size)
+ {
+ throw new ArrayIndexOutOfBoundsException();
+ }
+ return names[index];
+ }
+
+ public PathElement[] getRelPath(int relativeDegree)
+ {
+ PathElement[] relPath =3D new PathElement[relativeDegree];
+ System.arraycopy(names, size - relativeDegree, relPath, 0, relativeD=
egree);
+ return relPath;
+ }
+
+ public QPath getInternalPath()
+ {
+ if (cachedInternalQPath =3D=3D null)
+ {
+ QPathEntry[] entries =3D new QPathEntry[size];
+
+ for (int i =3D 0; i < size; i++)
+ entries[i] =3D new QPathEntry(names[i].getNamespace(), names[i=
].getName(), names[i].getIndex());
+
+ cachedInternalQPath =3D new QPath(entries);
+ }
+
+ return cachedInternalQPath;
+ }
+
+ public String getAsString(boolean showIndex)
+ {
+ if (showIndex)
+ {
+ if (cachedToStringShowIndex !=3D null)
+ {
+ return cachedToStringShowIndex;
+ }
+ }
+ else
+ {
+ if (cachedToString !=3D null)
+ {
+ return cachedToString;
+ }
+ }
+
+ // [PN] 27.06.07
+ String path;
+ if (isAbsolute())
+ {
+ if (size =3D=3D 1)
+ {
+ path =3D "/";
+ }
+ else
+ {
+ StringBuilder builder =3D new StringBuilder();
+ for (int i =3D 1; i < size; i++)
+ {
+ builder.append("/").append(names[i].getAsString(showIndex));
+ }
+ path =3D builder.toString();
+ }
+ }
+ else
+ {
+ // relative
+ StringBuilder builder =3D new StringBuilder();
+ for (int i =3D 0; i < size; i++)
+ {
+ if (i > 0)
+ {
+ builder.append("/");
+ }
+ else
+ {
+
+ }
+ builder.append(names[i].getAsString(showIndex));
+ }
+ path =3D builder.toString();
+ }
+
+
+ //
+ if (showIndex)
+ {
+ cachedToStringShowIndex =3D path;
+ }
+ else
+ {
+ cachedToString =3D path;
+ }
+
+ //
+ return path;
+ }
+
+ public int getDepth()
+ {
+ return size - 1;
+ }
+
+ public boolean isDescendantOf(JCRPath ancestorLocation, boolean childOn=
ly)
+ {
+ return isDescendantOf((JCRPathExt)ancestorLocation, childOnly);
+ }
+
+ public boolean isDescendantOf(JCRPathExt ancestorLocation, boolean chil=
dOnly)
+ {
+ int depthDiff =3D getDepth() - ancestorLocation.getDepth();
+ if (depthDiff <=3D 0 || (childOnly && depthDiff !=3D 1))
+ return false;
+
+ JCRPathExt.PathElement[] anotherNames =3D ancestorLocation.names;
+ for (int i =3D 0; i < ancestorLocation.size; i++)
+ {
+ boolean result =3D anotherNames[i].equals(names[i]);
+ if (!result)
+ return false;
+ }
+ return true;
+ }
+
+ public boolean isAncestorOf(JCRPath descendantLocation, boolean childOn=
ly)
+ {
+ return descendantLocation.isDescendantOf(this, childOnly);
+ }
+
+ public PathElement getName()
+ {
+ if (size > 0)
+ return names[size - 1];
+
+ return THIS_ELEMENT;
+ }
+
+ public int getIndex()
+ {
+ return names[size - 1].getIndex();
+ }
+
+ public boolean isIndexSetExplicitly()
+ {
+ return names[size - 1].isIndexSetExplicitly();
+ }
+
+ public boolean isSameNameSibling(JCRPath anotherPath)
+ {
+ return isSameNameSibling((JCRPathExt)anotherPath);
+ }
+
+ public boolean isSameNameSibling(JCRPathExt anotherPath)
+ {
+ JCRName[] anotherNames =3D anotherPath.names;
+ for (int i =3D 0; i < anotherPath.size - 1; i++)
+ {
+ boolean result =3D anotherNames[i].equals(names[i]);
+ if (!result)
+ return false;
+ }
+ return getName().getName().equals(anotherPath.getName().getName())
+ && this.getName().getPrefix().equals(anotherPath.getName().getPre=
fix());
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (this =3D=3D obj)
+ {
+ return true;
+ }
+ if (obj instanceof JCRPathExt)
+ {
+ JCRPathExt other =3D (JCRPathExt)obj;
+ return this.getInternalPath().equals(other.getInternalPath());
+ }
+ return false;
+ }
+
+ public PathElement[] getEntries()
+ {
+ return names.clone();
+ }
+
+}
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exop=
latform/services/jcr/impl/core/LocationFactory.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatfor=
m/services/jcr/impl/core/LocationFactory.java 2010-10-08 11:45:06 UTC (rev =
3261)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatfor=
m/services/jcr/impl/core/LocationFactory.java 2010-10-08 12:04:24 UTC (rev =
3262)
@@ -65,19 +65,8 @@
*/
public JCRPath createJCRPath(JCRPath parentLoc, String relPath) throws =
RepositoryException
{
-
- JCRPath path =3D new JCRPath();
- for (int i =3D 0; i < parentLoc.getEntries().length; i++)
- {
- path.addEntry(parentLoc.getEntries()[i]);
- }
-
JCRPath addPath =3D parseNames(relPath, false);
- for (int i =3D 0; i < addPath.getEntries().length; i++)
- {
- path.addEntry(addPath.getEntries()[i]);
- }
- return path;
+ return parentLoc.add(addPath);
}
=
/**
@@ -125,30 +114,21 @@
*/
public JCRPath createJCRPath(QPath qPath) throws RepositoryException
{
-
- JCRPath path =3D new JCRPath();
- for (int i =3D 0; i < qPath.getEntries().length; i++)
- {
- QPathEntry entry =3D qPath.getEntries()[i];
- String prefix =3D namespaces.getNamespacePrefixByURI(entry.getNam=
espace());
- path.addEntry(entry.getNamespace(), entry.getName(), prefix, entr=
y.getIndex());
- }
-
- return path;
+ return JCRPath.createJCRPath(namespaces, qPath);
}
=
public JCRName createJCRName(InternalQName qname) throws RepositoryExce=
ption
{
String prefix =3D namespaces.getNamespacePrefixByURI(qname.getNamesp=
ace());
- return new JCRName(qname.getNamespace(), qname.getName(), prefix);
+ return new JCRName(qname, prefix);
}
=
public String formatPathElement(QPathEntry qe) throws RepositoryExcepti=
on
{
String prefix =3D namespaces.getNamespacePrefixByURI(qe.getNamespace=
());
- JCRPath p =3D new JCRPath();
- p.addEntry(qe.getNamespace(), qe.getName(), prefix, qe.getIndex());
- return p.getEntries()[0].getAsString(false);
+ JCRPath p =3D JCRPath.createJCRPath();
+ p =3D p.addEntry(qe.getNamespace(), qe.getName(), prefix, qe.getInde=
x());
+ return p.getEntry(0).getAsString(false);
}
=
/**
@@ -160,25 +140,17 @@
*/
public JCRName parseJCRName(String name) throws RepositoryException
{
- JCRPath.PathElement entry =3D parsePathEntry(new JCRPath(), name);
-
- return new JCRName(entry.getNamespace(), entry.getName(), entry.getP=
refix());
+ JCRPath path =3D parsePathEntry(JCRPath.createJCRPath(), name);
+ JCRPath.PathElement entry =3D path.getName();
+ return new JCRName(entry);
}
=
public JCRPath.PathElement[] createRelPath(QPathEntry[] relPath) throws=
RepositoryException
{
- JCRPath path =3D new JCRPath();
- // JCRPath.PathElement[] entries =3D new JCRPath.PathElement[relPath=
.length];
- for (QPathEntry element : relPath)
- {
- String uri =3D namespaces.getNamespaceURIByPrefix(element.getName=
space());
- String prefix =3D namespaces.getNamespacePrefixByURI(uri);
- path.addEntry(uri, element.getName(), prefix, element.getIndex());
- }
- return path.getEntries();
+ return JCRPath.createJCRPath(namespaces, relPath).getEntries();
}
=
- private JCRPath.PathElement parsePathEntry(JCRPath path, String name) t=
hrows RepositoryException
+ private JCRPath parsePathEntry(JCRPath path, String name) throws Reposi=
toryException
{
=
// should be reset here (if there is explicit index) or
@@ -232,8 +204,8 @@
throw new RepositoryException("Illegal path entry: \"" + name =
+ "\"");
}
=
- path.addEntry(namespaces.getNamespaceURIByPrefix(prefix), someNam=
e, prefix, index);
- return (JCRPath.PathElement)path.getName();
+ path =3D path.addEntry(namespaces.getNamespaceURIByPrefix(prefix)=
, someName, prefix, index);
+ return path;
=
}
catch (Exception e)
@@ -250,7 +222,7 @@
throw new RepositoryException("Illegal relPath: \"" + path + "\""=
);
}
=
- JCRPath jcrPath =3D new JCRPath();
+ JCRPath jcrPath =3D JCRPath.createJCRPath();
int start =3D 0;
if (!absolute)
{
@@ -262,7 +234,7 @@
{
throw new RepositoryException("Illegal relPath: \"" + path + "=
\"");
}
- jcrPath.addEntry(namespaces.getNamespaceURIByPrefix(""), "", "", =
-1);
+ jcrPath =3D jcrPath.addEntry(namespaces.getNamespaceURIByPrefix("=
"), "", "", -1);
}
else
{
@@ -280,7 +252,7 @@
=
if (start + 1 !=3D path.length())
{
- parsePathEntry(jcrPath, qname);
+ jcrPath =3D parsePathEntry(jcrPath, qname);
}
else
{
--===============9037778074661195710==--
From do-not-reply at jboss.org Fri Oct 8 08:39:12 2010
Content-Type: multipart/mixed; boundary="===============0264458403398140618=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3263 -
jcr/branches/1.14-CNK/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene.
Date: Fri, 08 Oct 2010 08:39:12 -0400
Message-ID: <201010081239.o98CdCk1001005@svn01.web.mwc.hst.phx2.redhat.com>
--===============0264458403398140618==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: nzamosenchuk
Date: 2010-10-08 08:39:11 -0400 (Fri, 08 Oct 2010)
New Revision: 3263
Removed:
jcr/branches/1.14-CNK/exo.jcr.component.core/src/main/java/org/exoplatfo=
rm/services/jcr/impl/core/query/lucene/IndexMerger.java
Modified:
jcr/branches/1.14-CNK/exo.jcr.component.core/src/main/java/org/exoplatfo=
rm/services/jcr/impl/core/query/lucene/MultiIndex.java
jcr/branches/1.14-CNK/exo.jcr.component.core/src/main/java/org/exoplatfo=
rm/services/jcr/impl/core/query/lucene/RedoLog.java
Log:
EXOJCR-987 Getting rid of Merger and actions inside MultiIndex
Deleted: jcr/branches/1.14-CNK/exo.jcr.component.core/src/main/java/org/exo=
platform/services/jcr/impl/core/query/lucene/IndexMerger.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/exo.jcr.component.core/src/main/java/org/exoplatf=
orm/services/jcr/impl/core/query/lucene/IndexMerger.java 2010-10-08 12:04:2=
4 UTC (rev 3262)
+++ jcr/branches/1.14-CNK/exo.jcr.component.core/src/main/java/org/exoplatf=
orm/services/jcr/impl/core/query/lucene/IndexMerger.java 2010-10-08 12:39:1=
1 UTC (rev 3263)
@@ -1,572 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.exoplatform.services.jcr.impl.core.query.lucene;
-
-import EDU.oswego.cs.dl.util.concurrent.Mutex;
-import EDU.oswego.cs.dl.util.concurrent.Sync;
-
-import org.apache.commons.collections.Buffer;
-import org.apache.commons.collections.BufferUtils;
-import org.apache.commons.collections.buffer.UnboundedFifoBuffer;
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.Term;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Merges indexes in a separate daemon thread.
- */
-class IndexMerger extends Thread implements IndexListener
-{
-
- /**
- * Logger instance for this class.
- */
- private static final Logger log =3D LoggerFactory.getLogger("exo.jcr.co=
mponent.core.IndexMerger");
-
- /**
- * Marker task to signal the background thread to quit.
- */
- private static final Merge QUIT =3D new Merge(new Index[0]);
-
- /**
- * minMergeDocs config parameter.
- */
- private int minMergeDocs =3D SearchIndex.DEFAULT_MIN_MERGE_DOCS;
-
- /**
- * maxMergeDocs config parameter
- */
- private int maxMergeDocs =3D SearchIndex.DEFAULT_MAX_MERGE_DOCS;
-
- /**
- * mergeFactor config parameter
- */
- private int mergeFactor =3D SearchIndex.DEFAULT_MERGE_FACTOR;
-
- /**
- * Queue of merge Tasks
- */
- private final Buffer mergeTasks =3D BufferUtils.blockingBuffer(new Unbo=
undedFifoBuffer());
-
- /**
- * List of id Term
that identify documents that were delet=
ed
- * while a merge was running.
- */
- private final List deletedDocuments =3D Collections.synchronizedList(ne=
w ArrayList());
-
- /**
- * List of IndexBucket
s in ascending document limit.
- */
- private final List indexBuckets =3D new ArrayList();
-
- /**
- * The MultiIndex
this index merger is working on.
- */
- private final MultiIndex multiIndex;
-
- /**
- * Monitor object to synchronize merge calculation.
- */
- private final Object lock =3D new Object();
-
- /**
- * Mutex that is acquired when replacing indexes on MultiIndex.
- */
- private final Sync indexReplacement =3D new Mutex();
-
- /**
- * When released, indicates that this index merger is idle.
- */
- private final Sync mergerIdle =3D new Mutex();
-
- /**
- * Creates an IndexMerger
.
- *
- * @param multiIndex the MultiIndex
.
- */
- IndexMerger(MultiIndex multiIndex)
- {
- this.multiIndex =3D multiIndex;
- setName("IndexMerger");
- setDaemon(true);
- try
- {
- mergerIdle.acquire();
- }
- catch (InterruptedException e)
- {
- // will never happen, lock is free upon construction
- throw new InternalError("Unable to acquire mutex after constructi=
on");
- }
- }
-
- /**
- * Informs the index merger that an index was added / created.
- *
- * @param name the name of the index.
- * @param numDocs the number of documents it contains.
- */
- void indexAdded(String name, int numDocs)
- {
- if (numDocs < 0)
- {
- throw new IllegalArgumentException("numDocs must be positive");
- }
- // multiple threads may enter this method:
- // - the background thread of this IndexMerger, when it replaces ind=
exes
- // after a successful merge
- // - a regular thread that updates the workspace
- //
- // therefore we have to synchronize this block
- synchronized (lock)
- {
- // initially create buckets
- if (indexBuckets.size() =3D=3D 0)
- {
- long lower =3D 0;
- long upper =3D minMergeDocs;
- while (upper < maxMergeDocs)
- {
- indexBuckets.add(new IndexBucket(lower, upper, true));
- lower =3D upper + 1;
- upper *=3D mergeFactor;
- }
- // one with upper =3D maxMergeDocs
- indexBuckets.add(new IndexBucket(lower, maxMergeDocs, false));
- // and another one as overflow, just in case...
- indexBuckets.add(new IndexBucket(maxMergeDocs + 1, Long.MAX_VA=
LUE, false));
- }
-
- // put index in bucket
- IndexBucket bucket =3D (IndexBucket)indexBuckets.get(indexBuckets=
.size() - 1);
- for (int i =3D 0; i < indexBuckets.size(); i++)
- {
- bucket =3D (IndexBucket)indexBuckets.get(i);
- if (bucket.fits(numDocs))
- {
- break;
- }
- }
- bucket.add(new Index(name, numDocs));
-
- if (log.isDebugEnabled())
- {
- log.debug("index added: name=3D" + name + ", numDocs=3D" + num=
Docs);
- }
-
- // if bucket does not allow merge, we don't have to continue
- if (!bucket.allowsMerge())
- {
- return;
- }
-
- // check if we need a merge
- if (bucket.size() >=3D mergeFactor)
- {
- long targetMergeDocs =3D bucket.upper;
- targetMergeDocs =3D Math.min(targetMergeDocs * mergeFactor, ma=
xMergeDocs);
- // sum up docs in bucket
- List indexesToMerge =3D new ArrayList();
- int mergeDocs =3D 0;
- for (Iterator it =3D bucket.iterator(); it.hasNext() && mergeD=
ocs <=3D targetMergeDocs;)
- {
- indexesToMerge.add(it.next());
- }
- if (indexesToMerge.size() > 2)
- {
- // found merge
- Index[] idxs =3D (Index[])indexesToMerge.toArray(new Index[=
indexesToMerge.size()]);
- bucket.removeAll(indexesToMerge);
- if (log.isDebugEnabled())
- {
- log.debug("requesting merge for " + indexesToMerge);
- }
- mergeTasks.add(new Merge(idxs));
- log.debug("merge queue now contains " + mergeTasks.size() +=
" tasks.");
- }
- }
- }
- }
-
- /**
- * @inheritDoc
- */
- public void documentDeleted(Term id)
- {
- log.debug("document deleted: " + id.text());
- deletedDocuments.add(id);
- }
-
- /**
- * When the calling thread returns this index merger will be idle, that=
is
- * there will be no merge tasks pending anymore. The method returns imm=
ediately
- * if there are currently no tasks pending at all.
- */
- void waitUntilIdle() throws InterruptedException
- {
- mergerIdle.acquire();
- // and immediately release again
- mergerIdle.release();
- }
-
- /**
- * Signals this IndexMerger
to stop and waits until it
- * has terminated.
- */
- void dispose()
- {
- log.debug("dispose IndexMerger");
- // get mutex for index replacements
- try
- {
- indexReplacement.acquire();
- }
- catch (InterruptedException e)
- {
- log.warn("Interrupted while acquiring index replacement sync: " +=
e);
- // try to stop IndexMerger without the sync
- }
-
- // clear task queue
- mergeTasks.clear();
-
- // send quit
- mergeTasks.add(QUIT);
- log.debug("quit sent");
-
- try
- {
- // give the merger thread some time to quit,
- // it is possible that the merger is busy working on a large inde=
x.
- // if that is the case we will just ignore it and the daemon will
- // die without being able to finish the merge.
- // at this point it is not possible anymore to replace indexes
- // on the MultiIndex because we hold the indexReplacement Sync.
- this.join(500);
- if (isAlive())
- {
- log.info("Unable to stop IndexMerger. Daemon is busy.");
- }
- else
- {
- log.debug("IndexMerger thread stopped");
- }
- log.debug("merge queue size: " + mergeTasks.size());
- }
- catch (InterruptedException e)
- {
- log.warn("Interrupted while waiting for IndexMerger thread to ter=
minate.");
- }
- }
-
- /**
- * Implements the index merging.
- */
- public void run()
- {
- for (;;)
- {
- boolean isIdle =3D false;
- if (mergeTasks.size() =3D=3D 0)
- {
- mergerIdle.release();
- isIdle =3D true;
- }
- Merge task =3D (Merge)mergeTasks.remove();
- if (task =3D=3D QUIT)
- {
- mergerIdle.release();
- break;
- }
- if (isIdle)
- {
- try
- {
- mergerIdle.acquire();
- }
- catch (InterruptedException e)
- {
- Thread.interrupted();
- log.warn("Unable to acquire mergerIdle sync");
- }
- }
-
- log.debug("accepted merge request");
-
- // reset deleted documents
- deletedDocuments.clear();
-
- // get readers
- String[] names =3D new String[task.indexes.length];
- for (int i =3D 0; i < task.indexes.length; i++)
- {
- names[i] =3D task.indexes[i].name;
- }
- try
- {
- log.debug("create new index");
- PersistentIndex index =3D multiIndex.getOrCreateIndex(null);
- boolean success =3D false;
- try
- {
-
- log.debug("get index readers from MultiIndex");
- IndexReader[] readers =3D multiIndex.getIndexReaders(names,=
this);
- try
- {
- // do the merge
- long time =3D System.currentTimeMillis();
- index.addIndexes(readers);
- time =3D System.currentTimeMillis() - time;
- int docCount =3D 0;
- for (int i =3D 0; i < readers.length; i++)
- {
- docCount +=3D readers[i].numDocs();
- }
- log.info("merged " + docCount + " documents in " + time =
+ " ms into " + index.getName() + ".");
- }
- finally
- {
- for (int i =3D 0; i < readers.length; i++)
- {
- try
- {
- Util.closeOrRelease(readers[i]);
- }
- catch (IOException e)
- {
- log.warn("Unable to close IndexReader: " + e);
- }
- }
- }
-
- // inform multi index
- // if we cannot get the sync immediately we have to quit
- if (!indexReplacement.attempt(0))
- {
- log.debug("index merging canceled");
- break;
- }
- try
- {
- log.debug("replace indexes");
- multiIndex.replaceIndexes(names, index, deletedDocuments=
);
- }
- finally
- {
- indexReplacement.release();
- }
-
- success =3D true;
-
- }
- finally
- {
- if (!success)
- {
- // delete index
- log.debug("deleting index " + index.getName());
- multiIndex.deleteIndex(index);
- }
- }
- }
- catch (Throwable e)
- {
- log.error("Error while merging indexes: ", e);
- }
- }
- log.info("IndexMerger terminated");
- }
-
- //-----------------------< merge properties >--------------------------=
-----
-
- /**
- * The merge factor.
- */
- public void setMergeFactor(int mergeFactor)
- {
- this.mergeFactor =3D mergeFactor;
- }
-
- /**
- * The initial threshold for number of documents to merge to a new inde=
x.
- */
- public void setMinMergeDocs(int minMergeDocs)
- {
- this.minMergeDocs =3D minMergeDocs;
- }
-
- /**
- * The maximum number of document to merge.
- */
- public void setMaxMergeDocs(int maxMergeDocs)
- {
- this.maxMergeDocs =3D maxMergeDocs;
- }
-
- //------------------------------< internal >---------------------------=
-----
-
- /**
- * Implements a simple struct that holds the name of an index and how
- * many document it contains. Index
is comparable using the
- * number of documents it contains.
- */
- private static final class Index implements Comparable
- {
-
- /**
- * The name of the index.
- */
- private final String name;
-
- /**
- * The number of documents the index contains.
- */
- private final int numDocs;
-
- /**
- * Creates a new index struct.
- *
- * @param name name of an index.
- * @param numDocs number of documents it contains.
- */
- Index(String name, int numDocs)
- {
- this.name =3D name;
- this.numDocs =3D numDocs;
- }
-
- /**
- * Indexes are first ordered by {@link #numDocs} and then by {@link
- * #name}.
- *
- * @param o the other Index
.
- * @return a negative integer, zero, or a positive integer as this
- * Index is less than, equal to, or greater than the specifi=
ed
- * Index.
- */
- public int compareTo(Object o)
- {
- Index other =3D (Index)o;
- int val =3D numDocs < other.numDocs ? -1 : (numDocs =3D=3D other.=
numDocs ? 0 : 1);
- if (val !=3D 0)
- {
- return val;
- }
- else
- {
- return name.compareTo(other.name);
- }
- }
-
- /**
- * @inheritDoc
- */
- public String toString()
- {
- return name + ":" + numDocs;
- }
- }
-
- /**
- * Defines a merge task, to merge a couple of indexes into a new index.
- */
- private static final class Merge
- {
-
- private final Index[] indexes;
-
- /**
- * Merge task, to merge indexes
into a new index with
- * name
.
- *
- * @param indexes the indexes to merge.
- */
- Merge(Index[] indexes)
- {
- this.indexes =3D new Index[indexes.length];
- System.arraycopy(indexes, 0, this.indexes, 0, indexes.length);
- }
- }
-
- /**
- * Implements a List
with a document limit value. An
- * IndexBucket
contains {@link Index}es with documents less
- * or equal the document limit of the bucket.
- */
- private static final class IndexBucket extends ArrayList
- {
-
- /**
- * The lower document limit.
- */
- private final long lower;
-
- /**
- * The upper document limit.
- */
- private final long upper;
-
- /**
- * Flag indicating if indexes in this bucket can be merged.
- */
- private final boolean allowMerge;
-
- /**
- * Creates a new IndexBucket
. Limits are both inclusive.
- *
- * @param lower document limit.
- * @param upper document limit.
- * @param allowMerge if indexes in this bucket can be merged.
- */
- IndexBucket(long lower, long upper, boolean allowMerge)
- {
- this.lower =3D lower;
- this.upper =3D upper;
- this.allowMerge =3D allowMerge;
- }
-
- /**
- * Returns true
if the number of documents fit in this
- * IndexBucket
; otherwise false
- *
- * @param numDocs the number of documents.
- * @return true
if numDocs
fit.
- */
- boolean fits(long numDocs)
- {
- return numDocs >=3D lower && numDocs <=3D upper;
- }
-
- /**
- * Returns true
if indexes in this bucket can be merged.
- *
- * @return true
if indexes in this bucket can be merged.
- */
- boolean allowsMerge()
- {
- return allowMerge;
- }
- }
-}
Modified: jcr/branches/1.14-CNK/exo.jcr.component.core/src/main/java/org/ex=
oplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/exo.jcr.component.core/src/main/java/org/exoplatf=
orm/services/jcr/impl/core/query/lucene/MultiIndex.java 2010-10-08 12:04:24=
UTC (rev 3262)
+++ jcr/branches/1.14-CNK/exo.jcr.component.core/src/main/java/org/exoplatf=
orm/services/jcr/impl/core/query/lucene/MultiIndex.java 2010-10-08 12:39:11=
UTC (rev 3263)
@@ -171,11 +171,6 @@
private long lastFileSystemFlushTime;
=
/**
- * The IndexMerger
for this MultiIndex
.
- */
- private final IndexMerger merger;
-
- /**
* Timer to schedule flushes of this index after some idle time.
*/
private static final Timer FLUSH_TIMER =3D new Timer(true);
@@ -265,12 +260,6 @@
// as of 1.5 deletable file is not used anymore
removeDeletable();
=
- // initialize IndexMerger
- merger =3D new IndexMerger(this);
- merger.setMaxMergeDocs(handler.getMaxMergeDocs());
- merger.setMergeFactor(handler.getMergeFactor());
- merger.setMinMergeDocs(handler.getMinMergeDocs());
-
// this method is run in privileged mode internally
IndexingQueueStore store =3D new IndexingQueueStore(indexDir);
=
@@ -299,7 +288,6 @@
index.setUseCompoundFile(handler.getUseCompoundFile());
index.setTermInfosIndexDivisor(handler.getTermInfosIndexDivisor()=
);
indexes.add(index);
- merger.indexAdded(index.getName(), index.getNumDocuments());
}
=
// init volatile index
@@ -398,10 +386,16 @@
{
long count =3D 0;
// traverse and index workspace
- executeAndLog(new Start(Action.INTERNAL_TRANSACTION));
+ =
+ // TODO: this was removed
+ //executeAndLog(new Start(Action.INTERNAL_TRANSACTION));
+ =
// NodeData rootState =3D (NodeData) stateMgr.getItemData(root=
Id);
count =3D createIndex(indexingTree.getIndexingRoot(), stateMgr=
, count);
- executeAndLog(new Commit(getTransactionId()));
+ =
+ // TODO : this was replaced
+ //executeAndLog(new Commit(getTransactionId()));
+ =
log.info("Created initial index for {} nodes", new Long(count)=
);
releaseMultiReader();
scheduleFlushTask();
@@ -467,23 +461,67 @@
try
{
long transactionId =3D nextTransactionId++;
- executeAndLog(new Start(transactionId));
+ =
+ // TODO: this was removed
+ //executeAndLog(new Start(transactionId));
=
for (Iterator it =3D remove.iterator(); it.hasNext();)
{
- executeAndLog(new DeleteNode(transactionId, (String)it.n=
ext()));
+ // TODO this was replaced
+ //executeAndLog(new DeleteNode(transactionId, (String)it=
.next()));
+ =
+ String uuidString =3D (String)it.next();
+ // check if indexing queue is still working on
+ // this node from a previous update
+ Document doc =3D indexingQueue.removeDocument(uuidString=
);
+ if (doc !=3D null)
+ {
+ Util.disposeDocument(doc);
+ }
+ Term idTerm =3D new Term(FieldNames.UUID, uuidString);
+ // if the document cannot be deleted from the volatile i=
ndex
+ // delete it from one of the persistent indexes.
+ int num =3D volatileIndex.removeDocument(idTerm);
+ if (num =3D=3D 0)
+ {
+ for (int i =3D indexes.size() - 1; i >=3D 0; i--)
+ {
+ // only look in registered indexes
+ PersistentIndex idx =3D (PersistentIndex)indexes.g=
et(i);
+ if (indexNames.contains(idx.getName()))
+ {
+ num =3D idx.removeDocument(idTerm);
+ if (num > 0)
+ {
+ break;
+ }
+ }
+ }
+ }
+ =
+ =
+ =
}
for (Iterator it =3D add.iterator(); it.hasNext();)
{
Document doc =3D (Document)it.next();
if (doc !=3D null)
{
- executeAndLog(new AddNode(transactionId, doc));
+ // TODO: ths is replaced
+ //executeAndLog(new AddNode(transactionId, doc));
+
+ if (doc !=3D null)
+ {
+ volatileIndex.addDocuments(new Document[]{doc});
+ }
+ =
// commit volatile index if needed
flush |=3D checkVolatileCommit();
}
}
- executeAndLog(new Commit(transactionId));
+ =
+ // TODO : this was replaced
+ //executeAndLog(new Commit(transactionId));
=
// flush whole index when volatile index has been commited.
if (flush)
@@ -558,11 +596,15 @@
try
{
Term idTerm =3D new Term(FieldNames.UUID, uuid.toString());
- executeAndLog(new Start(Action.INTERNAL_TRANSACTION));
+ =
+ // TODO: this was removed
+ //executeAndLog(new Start(Action.INTERNAL_TRANSACTION));
+ =
num =3D volatileIndex.removeDocument(idTerm);
if (num > 0)
{
- redoLog.append(new DeleteNode(getTransactionId(), uuid));
+ // TODO: removed line
+ //redoLog.append(new DeleteNode(getTransactionId(), uuid));
}
for (int i =3D 0; i < indexes.size(); i++)
{
@@ -573,12 +615,14 @@
int removed =3D index.removeDocument(idTerm);
if (removed > 0)
{
- redoLog.append(new DeleteNode(getTransactionId(), uuid));
+ // TODO: removed line
+ //redoLog.append(new DeleteNode(getTransactionId(), uuid=
));
}
num +=3D removed;
}
}
- executeAndLog(new Commit(getTransactionId()));
+ // TODO : this was replaced
+ //executeAndLog(new Commit(getTransactionId()));
}
finally
{
@@ -792,7 +836,8 @@
// if we are reindexing there is already an active transaction
if (!reindexing)
{
- executeAndLog(new Start(Action.INTERNAL_TRANS_REPL_INDEXES)=
);
+ // TODO: this was removed
+ //executeAndLog(new Start(Action.INTERNAL_TRANS_REPL_INDEXE=
S));
}
// delete obsolete indexes
Set names =3D new HashSet(Arrays.asList(obsoleteIndexes));
@@ -802,16 +847,37 @@
String indexName =3D (String)it.next();
if (indexNames.contains(indexName))
{
- executeAndLog(new DeleteIndex(getTransactionId(), indexN=
ame));
+ // TODO this was replaced
+ //executeAndLog(new DeleteIndex(getTransactionId(), inde=
xName));
+ =
+ for (Iterator it2 =3D indexes.iterator(); it2.hasNext();)
+ {
+ PersistentIndex idx =3D (PersistentIndex)it2.next();
+ if (idx.getName().equals(indexName))
+ {
+ idx.close();
+ deleteIndex(idx);
+ break;
+ }
+ }
+ =
}
}
=
// Index merger does not log an action when it creates the
// target
// index of the merge. We have to do this here.
- executeAndLog(new CreateIndex(getTransactionId(), index.getNam=
e()));
+ // TODO this was replaced
+ ///executeAndLog(new CreateIndex(getTransactionId(), index.get=
Name()));
=
- executeAndLog(new AddIndex(getTransactionId(), index.getName()=
));
+ PersistentIndex idx =3D getOrCreateIndex(index.getName());
+ =
+ // TODO: this is replaced
+ //executeAndLog(new AddIndex(getTransactionId(), index.getName=
()));
+ if (!indexNames.contains(index.getName()))
+ {
+ indexNames.addName(index.getName());
+ }
=
// delete documents in index
for (Iterator it =3D deleted.iterator(); it.hasNext();)
@@ -825,7 +891,9 @@
{
// only commit if we are not reindexing
// when reindexing the final commit is done at the very end
- executeAndLog(new Commit(getTransactionId()));
+ =
+ // TODO : this was replaced
+ //executeAndLog(new Commit(getTransactionId()));
}
}
finally
@@ -954,7 +1022,6 @@
// stop index merger
// when calling this method we must not lock this MultiIndex, oth=
erwise
// a deadlock might occur
- merger.dispose();
=
synchronized (this)
{
@@ -1108,7 +1175,8 @@
synchronized (this)
{
// commit volatile index
- executeAndLog(new Start(Action.INTERNAL_TRANSACTION));
+ // TODO: this was removed
+ //executeAndLog(new Start(Action.INTERNAL_TRANSACTION));
commitVolatileIndex();
=
// commit persistent indexes
@@ -1126,11 +1194,17 @@
// check if index still contains documents
if (index.getNumDocuments() =3D=3D 0)
{
- executeAndLog(new DeleteIndex(getTransactionId(), index.=
getName()));
+ // TODO THIS was replaced
+ //executeAndLog(new DeleteIndex(getTransactionId(), inde=
x.getName()));
+
+ index.close();
+ deleteIndex(index);
+
}
}
}
- executeAndLog(new Commit(getTransactionId()));
+ // TODO : this was replaced
+ //executeAndLog(new Commit(getTransactionId()));
=
indexNames.write();
=
@@ -1329,16 +1403,31 @@
=
long time =3D System.currentTimeMillis();
// create index
- CreateIndex create =3D new CreateIndex(getTransactionId(), null);
- executeAndLog(create);
+ =
+ //TODO this was replaced
+// CreateIndex create =3D new CreateIndex(getTransactionId(), null=
);
+// executeAndLog(create);
+ =
+ PersistentIndex idx =3D getOrCreateIndex(null);
=
// commit volatile index
- executeAndLog(new VolatileCommit(getTransactionId(), create.getIn=
dexName()));
+ =
+ // TODO THIS IS REPLACED
+ //executeAndLog(new VolatileCommit(getTransactionId(), idx.getNam=
e()));
=
+ idx.copyIndex(volatileIndex);
+ resetVolatileIndex();
+ =
+ // TODO this is replaced
// add new index
- AddIndex add =3D new AddIndex(getTransactionId(), create.getIndex=
Name());
- executeAndLog(add);
+// AddIndex add =3D new AddIndex(getTransactionId(), create.getInd=
exName());
+// executeAndLog(add);
=
+ if (!indexNames.contains(idx.getName()))
+ {
+ indexNames.addName(idx.getName());
+ }
+ =
// create new volatile index
resetVolatileIndex();
=
@@ -1376,7 +1465,11 @@
{
return count;
}
- executeAndLog(new AddNode(getTransactionId(), node.getIdentifier()));
+ =
+ // TODO: this is replaced
+ //executeAndLog(new AddNode(getTransactionId(), node.getIdentifier()=
));
+ volatileIndex.addDocuments(new Document[]{createDocument(node)});
+ =
if (++count % 100 =3D=3D 0)
{
=
@@ -1552,11 +1645,45 @@
{
for (Iterator it =3D finished.keySet().iterator(); it.hasNe=
xt();)
{
- executeAndLog(new DeleteNode(getTransactionId(), (String=
)it.next()));
+ // TODO this was replaced
+ //executeAndLog(new DeleteNode(getTransactionId(), (Stri=
ng)it.next()));
+ =
+ String uuidString =3D (String)it.next();
+ // check if indexing queue is still working on
+ // this node from a previous update
+ Document doc =3D indexingQueue.removeDocument(uuidString=
);
+ if (doc !=3D null)
+ {
+ Util.disposeDocument(doc);
+ }
+ Term idTerm =3D new Term(FieldNames.UUID, uuidString);
+ // if the document cannot be deleted from the volatile i=
ndex
+ // delete it from one of the persistent indexes.
+ int num =3D volatileIndex.removeDocument(idTerm);
+ if (num =3D=3D 0)
+ {
+ for (int i =3D indexes.size() - 1; i >=3D 0; i--)
+ {
+ // only look in registered indexes
+ PersistentIndex idx =3D (PersistentIndex)indexes.g=
et(i);
+ if (indexNames.contains(idx.getName()))
+ {
+ num =3D idx.removeDocument(idTerm);
+ if (num > 0)
+ {
+ return;
+ }
+ }
+ }
+ }
+ =
+ =
}
for (Iterator it =3D finished.values().iterator(); it.hasNe=
xt();)
{
- executeAndLog(new AddNode(getTransactionId(), (Document)=
it.next()));
+ // TODO this was replaced
+ //executeAndLog(new AddNode(getTransactionId(), (Documen=
t)it.next()));
+ volatileIndex.addDocuments(new Document[]{(Document)it.n=
ext()});
}
}
else
@@ -1790,35 +1917,35 @@
Action a;
if (actionLabel.equals(Action.ADD_NODE))
{
- a =3D AddNode.fromString(transactionId, arguments);
+ a =3D AddNode_.fromString(transactionId, arguments);
}
else if (actionLabel.equals(Action.ADD_INDEX))
{
- a =3D AddIndex.fromString(transactionId, arguments);
+ a =3D AddIndex_.fromString(transactionId, arguments);
}
else if (actionLabel.equals(Action.COMMIT))
{
- a =3D Commit.fromString(transactionId, arguments);
+ a =3D Commit_.fromString(transactionId, arguments);
}
else if (actionLabel.equals(Action.CREATE_INDEX))
{
- a =3D CreateIndex.fromString(transactionId, arguments);
+ a =3D CreateIndex_.fromString(transactionId, arguments);
}
else if (actionLabel.equals(Action.DELETE_INDEX))
{
- a =3D DeleteIndex.fromString(transactionId, arguments);
+ a =3D DeleteIndex_.fromString(transactionId, arguments);
}
else if (actionLabel.equals(Action.DELETE_NODE))
{
- a =3D DeleteNode.fromString(transactionId, arguments);
+ a =3D DeleteNode_.fromString(transactionId, arguments);
}
else if (actionLabel.equals(Action.START))
{
- a =3D Start.fromString(transactionId, arguments);
+ a =3D Start_.fromString(transactionId, arguments);
}
else if (actionLabel.equals(Action.VOLATILE_COMMIT))
{
- a =3D VolatileCommit.fromString(transactionId, arguments);
+ a =3D VolatileCommit_.fromString(transactionId, arguments);
}
else
{
@@ -1831,7 +1958,7 @@
/**
* Adds an index to the MultiIndex's active persistent index list.
*/
- private static class AddIndex extends Action
+ private static class AddIndex_ extends Action
{
=
/**
@@ -1848,7 +1975,7 @@
* the name of the index to add, or null
if =
an
* index with a new name should be created.
*/
- AddIndex(long transactionId, String indexName)
+ AddIndex_(long transactionId, String indexName)
{
super(transactionId, Action.TYPE_ADD_INDEX);
this.indexName =3D indexName;
@@ -1865,9 +1992,9 @@
* @throws IllegalArgumentException
* if the arguments are malformed.
*/
- static AddIndex fromString(long transactionId, String arguments)
+ static AddIndex_ fromString(long transactionId, String arguments)
{
- return new AddIndex(transactionId, arguments);
+ return new AddIndex_(transactionId, arguments);
}
=
/**
@@ -1882,9 +2009,6 @@
if (!index.indexNames.contains(indexName))
{
index.indexNames.addName(indexName);
- // now that the index is in the active list let the merger know
- // about it
- index.merger.indexAdded(indexName, idx.getNumDocuments());
}
}
=
@@ -1907,7 +2031,7 @@
/**
* Adds a node to the index.
*/
- private static class AddNode extends Action
+ private static class AddNode_ extends Action
{
=
/**
@@ -1935,7 +2059,7 @@
* @param uuid
* the uuid of the node to add.
*/
- AddNode(long transactionId, String uuid)
+ AddNode_(long transactionId, String uuid)
{
super(transactionId, Action.TYPE_ADD_NODE);
this.uuid =3D uuid;
@@ -1949,7 +2073,7 @@
* @param doc
* the document to add.
*/
- AddNode(long transactionId, Document doc)
+ AddNode_(long transactionId, Document doc)
{
this(transactionId, doc.get(FieldNames.UUID));
this.doc =3D doc;
@@ -1966,14 +2090,14 @@
* @throws IllegalArgumentException
* if the arguments are malformed. Not a UUID.
*/
- static AddNode fromString(long transactionId, String arguments) thro=
ws IllegalArgumentException
+ static AddNode_ fromString(long transactionId, String arguments) thr=
ows IllegalArgumentException
{
// simple length check
if (arguments.length() !=3D Constants.UUID_FORMATTED_LENGTH)
{
throw new IllegalArgumentException("arguments is not a uuid");
}
- return new AddNode(transactionId, arguments);
+ return new AddNode_(transactionId, arguments);
}
=
/**
@@ -2021,7 +2145,7 @@
/**
* Commits a transaction.
*/
- private static class Commit extends Action
+ private static class Commit_ extends Action
{
=
/**
@@ -2030,7 +2154,7 @@
* @param transactionId
* the id of the transaction that is committed.
*/
- Commit(long transactionId)
+ Commit_(long transactionId)
{
super(transactionId, Action.TYPE_COMMIT);
}
@@ -2044,9 +2168,9 @@
* ignored by this method.
* @return the Commit action.
*/
- static Commit fromString(long transactionId, String arguments)
+ static Commit_ fromString(long transactionId, String arguments)
{
- return new Commit(transactionId);
+ return new Commit_(transactionId);
}
=
/**
@@ -2074,7 +2198,7 @@
* Creates an new sub index but does not add it to the active persistent
* index list.
*/
- private static class CreateIndex extends Action
+ private static class CreateIndex_ extends Action
{
=
/**
@@ -2091,7 +2215,7 @@
* the name of the index to add, or null
if =
an
* index with a new name should be created.
*/
- CreateIndex(long transactionId, String indexName)
+ CreateIndex_(long transactionId, String indexName)
{
super(transactionId, Action.TYPE_CREATE_INDEX);
this.indexName =3D indexName;
@@ -2108,10 +2232,10 @@
* @throws IllegalArgumentException
* if the arguments are malformed.
*/
- static CreateIndex fromString(long transactionId, String arguments)
+ static CreateIndex_ fromString(long transactionId, String arguments)
{
// when created from String, this action is executed as redo acti=
on
- return new CreateIndex(transactionId, arguments);
+ return new CreateIndex_(transactionId, arguments);
}
=
/**
@@ -2171,7 +2295,7 @@
/**
* Closes and deletes an index that is no longer in use.
*/
- private static class DeleteIndex extends Action
+ private static class DeleteIndex_ extends Action
{
=
/**
@@ -2187,7 +2311,7 @@
* @param indexName
* the name of the index to delete.
*/
- DeleteIndex(long transactionId, String indexName)
+ DeleteIndex_(long transactionId, String indexName)
{
super(transactionId, Action.TYPE_DELETE_INDEX);
this.indexName =3D indexName;
@@ -2204,9 +2328,9 @@
* @throws IllegalArgumentException
* if the arguments are malformed.
*/
- static DeleteIndex fromString(long transactionId, String arguments)
+ static DeleteIndex_ fromString(long transactionId, String arguments)
{
- return new DeleteIndex(transactionId, arguments);
+ return new DeleteIndex_(transactionId, arguments);
}
=
/**
@@ -2249,7 +2373,7 @@
/**
* Deletes a node from the index.
*/
- private static class DeleteNode extends Action
+ private static class DeleteNode_ extends Action
{
=
/**
@@ -2271,7 +2395,7 @@
* @param uuid
* the uuid of the node to delete.
*/
- DeleteNode(long transactionId, String uuid)
+ DeleteNode_(long transactionId, String uuid)
{
super(transactionId, Action.TYPE_DELETE_NODE);
this.uuid =3D uuid;
@@ -2288,14 +2412,14 @@
* @throws IllegalArgumentException
* if the arguments are malformed. Not a UUID.
*/
- static DeleteNode fromString(long transactionId, String arguments)
+ static DeleteNode_ fromString(long transactionId, String arguments)
{
// simple length check
if (arguments.length() !=3D Constants.UUID_FORMATTED_LENGTH)
{
throw new IllegalArgumentException("arguments is not a uuid");
}
- return new DeleteNode(transactionId, arguments);
+ return new DeleteNode_(transactionId, arguments);
}
=
/**
@@ -2355,7 +2479,7 @@
/**
* Starts a transaction.
*/
- private static class Start extends Action
+ private static class Start_ extends Action
{
=
/**
@@ -2364,7 +2488,7 @@
* @param transactionId
* the id of the transaction that started.
*/
- Start(long transactionId)
+ Start_(long transactionId)
{
super(transactionId, Action.TYPE_START);
}
@@ -2378,9 +2502,9 @@
* ignored by this method.
* @return the Start action.
*/
- static Start fromString(long transactionId, String arguments)
+ static Start_ fromString(long transactionId, String arguments)
{
- return new Start(transactionId);
+ return new Start_(transactionId);
}
=
/**
@@ -2407,7 +2531,7 @@
/**
* Commits the volatile index to disk.
*/
- private static class VolatileCommit extends Action
+ private static class VolatileCommit_ extends Action
{
=
/**
@@ -2421,7 +2545,7 @@
* @param transactionId
* the id of the transaction that executes this action.
*/
- VolatileCommit(long transactionId, String targetIndex)
+ VolatileCommit_(long transactionId, String targetIndex)
{
super(transactionId, Action.TYPE_VOLATILE_COMMIT);
this.targetIndex =3D targetIndex;
@@ -2436,9 +2560,9 @@
* ignored by this implementation.
* @return the VolatileCommit action.
*/
- static VolatileCommit fromString(long transactionId, String argument=
s)
+ static VolatileCommit_ fromString(long transactionId, String argumen=
ts)
{
- return new VolatileCommit(transactionId, arguments);
+ return new VolatileCommit_(transactionId, arguments);
}
=
/**
@@ -2500,7 +2624,6 @@
protected void setReadOny()
{
// try to stop merger in safe way
- merger.dispose();
flushTask.cancel();
FLUSH_TIMER.purge();
this.redoLog =3D null;
@@ -2532,18 +2655,8 @@
attemptDelete();
=
// now that we are ready, start index merger
- merger.start();
if (redoLogApplied)
{
- // wait for the index merge to finish pending jobs
- try
- {
- merger.waitUntilIdle();
- }
- catch (InterruptedException e)
- {
- // move on
- }
flush();
}
=
Modified: jcr/branches/1.14-CNK/exo.jcr.component.core/src/main/java/org/ex=
oplatform/services/jcr/impl/core/query/lucene/RedoLog.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/exo.jcr.component.core/src/main/java/org/exoplatf=
orm/services/jcr/impl/core/query/lucene/RedoLog.java 2010-10-08 12:04:24 UT=
C (rev 3262)
+++ jcr/branches/1.14-CNK/exo.jcr.component.core/src/main/java/org/exoplatf=
orm/services/jcr/impl/core/query/lucene/RedoLog.java 2010-10-08 12:39:11 UT=
C (rev 3263)
@@ -193,7 +193,10 @@
out.close();
out =3D null;
}
- dir.deleteFile(REDO_LOG);
+ if (dir.fileExists(REDO_LOG))
+ {
+ dir.deleteFile(REDO_LOG);
+ }
entryCount =3D 0;
return null;
}
@@ -208,17 +211,17 @@
private void initOut() throws IOException
{
SecurityHelper.doPriviledgedIOExceptionAction(new PrivilegedExceptio=
nAction()
+ {
+ public Object run() throws Exception
{
- public Object run() throws Exception
- {
if (out =3D=3D null)
{
OutputStream os =3D new IndexOutputStream(dir.createOutput(=
REDO_LOG));
out =3D new BufferedWriter(new OutputStreamWriter(os));
}
- return null;
- }
- });
+ return null;
+ }
+ });
}
=
/**
@@ -231,9 +234,9 @@
private void read(final ActionCollector collector) throws IOException
{
SecurityHelper.doPriviledgedIOExceptionAction(new PrivilegedExceptio=
nAction()
+ {
+ public Object run() throws Exception
{
- public Object run() throws Exception
- {
if (!dir.fileExists(REDO_LOG))
{
return null;
@@ -269,9 +272,9 @@
}
}
}
- return null;
- }
- });
+ return null;
+ }
+ });
}
=
//-----------------------< internal >----------------------------------=
-----
--===============0264458403398140618==--
From do-not-reply at jboss.org Fri Oct 8 09:03:56 2010
Content-Type: multipart/mixed; boundary="===============7349350063708105368=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3264 -
jcr/branches/1.14-CNK/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene.
Date: Fri, 08 Oct 2010 09:03:56 -0400
Message-ID: <201010081303.o98D3uOX008270@svn01.web.mwc.hst.phx2.redhat.com>
--===============7349350063708105368==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: nzamosenchuk
Date: 2010-10-08 09:03:55 -0400 (Fri, 08 Oct 2010)
New Revision: 3264
Removed:
jcr/branches/1.14-CNK/exo.jcr.component.core/src/main/java/org/exoplatfo=
rm/services/jcr/impl/core/query/lucene/Recovery.java
jcr/branches/1.14-CNK/exo.jcr.component.core/src/main/java/org/exoplatfo=
rm/services/jcr/impl/core/query/lucene/RedoLog.java
Modified:
jcr/branches/1.14-CNK/exo.jcr.component.core/src/main/java/org/exoplatfo=
rm/services/jcr/impl/core/query/lucene/MultiIndex.java
Log:
EXOJCR-987 : actions and redo successfully deleted
Modified: jcr/branches/1.14-CNK/exo.jcr.component.core/src/main/java/org/ex=
oplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/exo.jcr.component.core/src/main/java/org/exoplatf=
orm/services/jcr/impl/core/query/lucene/MultiIndex.java 2010-10-08 12:39:11=
UTC (rev 3263)
+++ jcr/branches/1.14-CNK/exo.jcr.component.core/src/main/java/org/exoplatf=
orm/services/jcr/impl/core/query/lucene/MultiIndex.java 2010-10-08 13:03:55=
UTC (rev 3264)
@@ -23,7 +23,6 @@
import org.exoplatform.services.jcr.dataflow.ItemDataConsumer;
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.NodeData;
-import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.core.query.IndexerIoMode;
import org.exoplatform.services.jcr.impl.core.query.IndexerIoModeHandler;
import org.exoplatform.services.jcr.impl.core.query.IndexerIoModeListener;
@@ -156,11 +155,6 @@
private final Object updateMonitor =3D new Object();
=
/**
- * true
if the redo log contained entries on startup.
- */
- private boolean redoLogApplied =3D false;
-
- /**
* The time this index was last flushed or a transaction was committed.
*/
private long lastFlushTime;
@@ -182,11 +176,6 @@
private TimerTask flushTask;
=
/**
- * The RedoLog of this MultiIndex
.
- */
- private RedoLog redoLog =3D null;
-
- /**
* The indexing queue with pending text extraction jobs.
*/
private IndexingQueue indexingQueue;
@@ -202,11 +191,6 @@
private long nextTransactionId =3D 0;
=
/**
- * The current transaction id.
- */
- private long currentTransactionId =3D -1;
-
- /**
* Flag indicating whether re-indexing is running.
*/
private boolean reindexing =3D false;
@@ -386,16 +370,16 @@
{
long count =3D 0;
// traverse and index workspace
- =
+
// TODO: this was removed
//executeAndLog(new Start(Action.INTERNAL_TRANSACTION));
- =
+
// NodeData rootState =3D (NodeData) stateMgr.getItemData(root=
Id);
count =3D createIndex(indexingTree.getIndexingRoot(), stateMgr=
, count);
- =
+
// TODO : this was replaced
//executeAndLog(new Commit(getTransactionId()));
- =
+
log.info("Created initial index for {} nodes", new Long(count)=
);
releaseMultiReader();
scheduleFlushTask();
@@ -461,15 +445,15 @@
try
{
long transactionId =3D nextTransactionId++;
- =
- // TODO: this was removed
+
+ // TODO: this was removed
//executeAndLog(new Start(transactionId));
=
for (Iterator it =3D remove.iterator(); it.hasNext();)
{
// TODO this was replaced
//executeAndLog(new DeleteNode(transactionId, (String)it=
.next()));
- =
+
String uuidString =3D (String)it.next();
// check if indexing queue is still working on
// this node from a previous update
@@ -498,9 +482,7 @@
}
}
}
- =
- =
- =
+
}
for (Iterator it =3D add.iterator(); it.hasNext();)
{
@@ -514,13 +496,13 @@
{
volatileIndex.addDocuments(new Document[]{doc});
}
- =
+
// commit volatile index if needed
flush |=3D checkVolatileCommit();
}
}
- =
- // TODO : this was replaced
+
+ // TODO : this was replaced
//executeAndLog(new Commit(transactionId));
=
// flush whole index when volatile index has been commited.
@@ -596,10 +578,10 @@
try
{
Term idTerm =3D new Term(FieldNames.UUID, uuid.toString());
- =
- // TODO: this was removed
+
+ // TODO: this was removed
//executeAndLog(new Start(Action.INTERNAL_TRANSACTION));
- =
+
num =3D volatileIndex.removeDocument(idTerm);
if (num > 0)
{
@@ -621,7 +603,7 @@
num +=3D removed;
}
}
- // TODO : this was replaced
+ // TODO : this was replaced
//executeAndLog(new Commit(getTransactionId()));
}
finally
@@ -849,7 +831,7 @@
{
// TODO this was replaced
//executeAndLog(new DeleteIndex(getTransactionId(), inde=
xName));
- =
+
for (Iterator it2 =3D indexes.iterator(); it2.hasNext();)
{
PersistentIndex idx =3D (PersistentIndex)it2.next();
@@ -860,7 +842,7 @@
break;
}
}
- =
+
}
}
=
@@ -871,7 +853,7 @@
///executeAndLog(new CreateIndex(getTransactionId(), index.get=
Name()));
=
PersistentIndex idx =3D getOrCreateIndex(index.getName());
- =
+
// TODO: this is replaced
//executeAndLog(new AddIndex(getTransactionId(), index.getName=
()));
if (!indexNames.contains(index.getName()))
@@ -891,8 +873,8 @@
{
// only commit if we are not reindexing
// when reindexing the final commit is done at the very end
- =
- // TODO : this was replaced
+
+ // TODO : this was replaced
//executeAndLog(new Commit(getTransactionId()));
}
}
@@ -1130,17 +1112,6 @@
}
=
/**
- * Returns true
if the redo log contained entries while th=
is
- * index was instantiated; false
otherwise.
- * =
- * @return true
if the redo log contained entries.
- */
- boolean getRedoLogApplied()
- {
- return redoLogApplied;
- }
-
- /**
* Removes the index
from the list of active sub indexes. =
The
* Index is not acutally deleted right away, but postponed to the
* transaction commit.
@@ -1198,19 +1169,17 @@
//executeAndLog(new DeleteIndex(getTransactionId(), inde=
x.getName()));
=
index.close();
- deleteIndex(index);
+ deleteIndex(index);
=
}
}
}
- // TODO : this was replaced
+ // TODO : this was replaced
//executeAndLog(new Commit(getTransactionId()));
=
indexNames.write();
=
// reset redo log
- redoLog.clear();
-
lastFlushTime =3D System.currentTimeMillis();
lastFileSystemFlushTime =3D System.currentTimeMillis();
}
@@ -1326,48 +1295,6 @@
}
=
/**
- * Returns the current transaction id.
- * =
- * @return the current transaction id.
- */
- private long getTransactionId()
- {
- return currentTransactionId;
- }
-
- /**
- * Executes action a
and appends the action to the redo lo=
g if
- * successful.
- * =
- * @param a
- * the Action
to execute.
- * @return the executed action.
- * @throws IOException
- * if an error occurs while executing the action or appendi=
ng
- * the action to the redo log.
- */
- private Action executeAndLog(final Action a) throws IOException
- {
- return SecurityHelper.doPriviledgedIOExceptionAction(new PrivilegedE=
xceptionAction()
- {
- public Action run() throws Exception
- {
- a.execute(MultiIndex.this);
- redoLog.append(a);
- // please note that flushing the redo log is only required on
- // commit, but we also want to keep track of new indexes for s=
ure.
- // otherwise it might happen that unused index folders are orp=
haned
- // after a crash.
- if (a.getType() =3D=3D Action.TYPE_COMMIT || a.getType() =3D=
=3D Action.TYPE_ADD_INDEX)
- {
- redoLog.flush();
- }
- return a;
- }
- });
- }
-
- /**
* Checks if it is needed to commit the volatile index according to
* {@link SearchIndex#getMaxVolatileIndexSize()}.
* =
@@ -1403,31 +1330,31 @@
=
long time =3D System.currentTimeMillis();
// create index
- =
+
//TODO this was replaced
-// CreateIndex create =3D new CreateIndex(getTransactionId(), null=
);
-// executeAndLog(create);
- =
+ // CreateIndex create =3D new CreateIndex(getTransactionI=
d(), null);
+ // executeAndLog(create);
+
PersistentIndex idx =3D getOrCreateIndex(null);
=
// commit volatile index
- =
+
// TODO THIS IS REPLACED
//executeAndLog(new VolatileCommit(getTransactionId(), idx.getNam=
e()));
=
idx.copyIndex(volatileIndex);
resetVolatileIndex();
- =
+
// TODO this is replaced
// add new index
-// AddIndex add =3D new AddIndex(getTransactionId(), create.getInd=
exName());
-// executeAndLog(add);
+ // AddIndex add =3D new AddIndex(getTransactionId(), crea=
te.getIndexName());
+ // executeAndLog(add);
=
if (!indexNames.contains(idx.getName()))
{
indexNames.addName(idx.getName());
}
- =
+
// create new volatile index
resetVolatileIndex();
=
@@ -1465,11 +1392,11 @@
{
return count;
}
- =
+
// TODO: this is replaced
//executeAndLog(new AddNode(getTransactionId(), node.getIdentifier()=
));
volatileIndex.addDocuments(new Document[]{createDocument(node)});
- =
+
if (++count % 100 =3D=3D 0)
{
=
@@ -1565,7 +1492,6 @@
{
try
{
- if (redoLog.hasEntries())
{
log.debug("Flushing index after being idle for " + idleTime=
+ " ms.");
synchronized (updateMonitor)
@@ -1647,7 +1573,7 @@
{
// TODO this was replaced
//executeAndLog(new DeleteNode(getTransactionId(), (Stri=
ng)it.next()));
- =
+
String uuidString =3D (String)it.next();
// check if indexing queue is still working on
// this node from a previous update
@@ -1676,8 +1602,7 @@
}
}
}
- =
- =
+
}
for (Iterator it =3D finished.values().iterator(); it.hasNe=
xt();)
{
@@ -1703,899 +1628,6 @@
// >---------------------------------------
=
/**
- * Defines an action on an MultiIndex
.
- */
- public abstract static class Action
- {
-
- /**
- * Action identifier in redo log for transaction start action.
- */
- static final String START =3D "STR";
-
- /**
- * Action type for start action.
- */
- public static final int TYPE_START =3D 0;
-
- /**
- * Action identifier in redo log for add node action.
- */
- static final String ADD_NODE =3D "ADD";
-
- /**
- * Action type for add node action.
- */
- public static final int TYPE_ADD_NODE =3D 1;
-
- /**
- * Action identifier in redo log for node delete action.
- */
- static final String DELETE_NODE =3D "DEL";
-
- /**
- * Action type for delete node action.
- */
- public static final int TYPE_DELETE_NODE =3D 2;
-
- /**
- * Action identifier in redo log for transaction commit action.
- */
- static final String COMMIT =3D "COM";
-
- /**
- * Action type for commit action.
- */
- public static final int TYPE_COMMIT =3D 3;
-
- /**
- * Action identifier in redo log for volatile index commit action.
- */
- static final String VOLATILE_COMMIT =3D "VOL_COM";
-
- /**
- * Action type for volatile index commit action.
- */
- public static final int TYPE_VOLATILE_COMMIT =3D 4;
-
- /**
- * Action identifier in redo log for index create action.
- */
- static final String CREATE_INDEX =3D "CRE_IDX";
-
- /**
- * Action type for create index action.
- */
- public static final int TYPE_CREATE_INDEX =3D 5;
-
- /**
- * Action identifier in redo log for index add action.
- */
- static final String ADD_INDEX =3D "ADD_IDX";
-
- /**
- * Action type for add index action.
- */
- public static final int TYPE_ADD_INDEX =3D 6;
-
- /**
- * Action identifier in redo log for delete index action.
- */
- static final String DELETE_INDEX =3D "DEL_IDX";
-
- /**
- * Action type for delete index action.
- */
- public static final int TYPE_DELETE_INDEX =3D 7;
-
- /**
- * Transaction identifier for internal actions like volatile index
- * commit triggered by timer thread.
- */
- static final long INTERNAL_TRANSACTION =3D -1;
-
- /**
- * Transaction identifier for internal action that replaces indexs.
- */
- static final long INTERNAL_TRANS_REPL_INDEXES =3D -2;
-
- /**
- * The id of the transaction that executed this action.
- */
- private final long transactionId;
-
- /**
- * The action type.
- */
- private final int type;
-
- /**
- * Creates a new Action
.
- * =
- * @param transactionId
- * the id of the transaction that executed this action.
- * @param type
- * the action type.
- */
- Action(long transactionId, int type)
- {
- this.transactionId =3D transactionId;
- this.type =3D type;
- }
-
- /**
- * Returns the transaction id for this Action
.
- * =
- * @return the transaction id for this Action
.
- */
- long getTransactionId()
- {
- return transactionId;
- }
-
- /**
- * Returns the action type.
- * =
- * @return the action type.
- */
- int getType()
- {
- return type;
- }
-
- /**
- * Executes this action on the index
.
- * =
- * @param index
- * the index where to execute the action.
- * @throws IOException
- * if the action fails due to some I/O error in the inde=
x or
- * some other error.
- */
- public abstract void execute(MultiIndex index) throws IOException;
-
- /**
- * Executes the inverse operation of this action. That is, does an u=
ndo
- * of this action. This default implementation does nothing, but ret=
urns
- * silently.
- * =
- * @param index
- * the index where to undo the action.
- * @throws IOException
- * if the action cannot be undone.
- */
- public void undo(MultiIndex index) throws IOException
- {
- }
-
- /**
- * Returns a String
representation of this action that =
can
- * be written to the {@link RedoLog}.
- * =
- * @return a String
representation of this action.
- */
- @Override
- public abstract String toString();
-
- /**
- * Parses an line in the redo log and created an {@link Action}.
- * =
- * @param line
- * the line from the redo log.
- * @return an Action
.
- * @throws IllegalArgumentException
- * if the line is malformed.
- */
- static Action fromString(String line) throws IllegalArgumentException
- {
- int endTransIdx =3D line.indexOf(' ');
- if (endTransIdx =3D=3D -1)
- {
- throw new IllegalArgumentException(line);
- }
- long transactionId;
- try
- {
- transactionId =3D Long.parseLong(line.substring(0, endTransIdx=
));
- }
- catch (NumberFormatException e)
- {
- throw new IllegalArgumentException(line);
- }
- int endActionIdx =3D line.indexOf(' ', endTransIdx + 1);
- if (endActionIdx =3D=3D -1)
- {
- // action does not have arguments
- endActionIdx =3D line.length();
- }
- String actionLabel =3D line.substring(endTransIdx + 1, endActionI=
dx);
- String arguments =3D "";
- if (endActionIdx + 1 <=3D line.length())
- {
- arguments =3D line.substring(endActionIdx + 1);
- }
- Action a;
- if (actionLabel.equals(Action.ADD_NODE))
- {
- a =3D AddNode_.fromString(transactionId, arguments);
- }
- else if (actionLabel.equals(Action.ADD_INDEX))
- {
- a =3D AddIndex_.fromString(transactionId, arguments);
- }
- else if (actionLabel.equals(Action.COMMIT))
- {
- a =3D Commit_.fromString(transactionId, arguments);
- }
- else if (actionLabel.equals(Action.CREATE_INDEX))
- {
- a =3D CreateIndex_.fromString(transactionId, arguments);
- }
- else if (actionLabel.equals(Action.DELETE_INDEX))
- {
- a =3D DeleteIndex_.fromString(transactionId, arguments);
- }
- else if (actionLabel.equals(Action.DELETE_NODE))
- {
- a =3D DeleteNode_.fromString(transactionId, arguments);
- }
- else if (actionLabel.equals(Action.START))
- {
- a =3D Start_.fromString(transactionId, arguments);
- }
- else if (actionLabel.equals(Action.VOLATILE_COMMIT))
- {
- a =3D VolatileCommit_.fromString(transactionId, arguments);
- }
- else
- {
- throw new IllegalArgumentException(line);
- }
- return a;
- }
- }
-
- /**
- * Adds an index to the MultiIndex's active persistent index list.
- */
- private static class AddIndex_ extends Action
- {
-
- /**
- * The name of the index to add.
- */
- private String indexName;
-
- /**
- * Creates a new AddIndex action.
- * =
- * @param transactionId
- * the id of the transaction that executes this action.
- * @param indexName
- * the name of the index to add, or null
if =
an
- * index with a new name should be created.
- */
- AddIndex_(long transactionId, String indexName)
- {
- super(transactionId, Action.TYPE_ADD_INDEX);
- this.indexName =3D indexName;
- }
-
- /**
- * Creates a new AddIndex action.
- * =
- * @param transactionId
- * the id of the transaction that executes this action.
- * @param arguments
- * the name of the index to add.
- * @return the AddIndex action.
- * @throws IllegalArgumentException
- * if the arguments are malformed.
- */
- static AddIndex_ fromString(long transactionId, String arguments)
- {
- return new AddIndex_(transactionId, arguments);
- }
-
- /**
- * Adds a sub index to index
.
- * =
- * @inheritDoc
- */
- @Override
- public void execute(MultiIndex index) throws IOException
- {
- PersistentIndex idx =3D index.getOrCreateIndex(indexName);
- if (!index.indexNames.contains(indexName))
- {
- index.indexNames.addName(indexName);
- }
- }
-
- /**
- * @inheritDoc
- */
- @Override
- public String toString()
- {
- StringBuffer logLine =3D new StringBuffer();
- logLine.append(Long.toString(getTransactionId()));
- logLine.append(' ');
- logLine.append(Action.ADD_INDEX);
- logLine.append(' ');
- logLine.append(indexName);
- return logLine.toString();
- }
- }
-
- /**
- * Adds a node to the index.
- */
- private static class AddNode_ extends Action
- {
-
- /**
- * The maximum length of a AddNode String.
- */
- private static final int ENTRY_LENGTH =3D
- Long.toString(Long.MAX_VALUE).length() + Action.ADD_NODE.length()=
+ Constants.UUID_FORMATTED_LENGTH + 2;
-
- /**
- * The uuid of the node to add.
- */
- private final String uuid;
-
- /**
- * The document to add to the index, or null
if not
- * available.
- */
- private Document doc;
-
- /**
- * Creates a new AddNode action.
- * =
- * @param transactionId
- * the id of the transaction that executes this action.
- * @param uuid
- * the uuid of the node to add.
- */
- AddNode_(long transactionId, String uuid)
- {
- super(transactionId, Action.TYPE_ADD_NODE);
- this.uuid =3D uuid;
- }
-
- /**
- * Creates a new AddNode action.
- * =
- * @param transactionId
- * the id of the transaction that executes this action.
- * @param doc
- * the document to add.
- */
- AddNode_(long transactionId, Document doc)
- {
- this(transactionId, doc.get(FieldNames.UUID));
- this.doc =3D doc;
- }
-
- /**
- * Creates a new AddNode action.
- * =
- * @param transactionId
- * the id of the transaction that executes this action.
- * @param arguments
- * the arguments to this action. The uuid of the node to =
add
- * @return the AddNode action.
- * @throws IllegalArgumentException
- * if the arguments are malformed. Not a UUID.
- */
- static AddNode_ fromString(long transactionId, String arguments) thr=
ows IllegalArgumentException
- {
- // simple length check
- if (arguments.length() !=3D Constants.UUID_FORMATTED_LENGTH)
- {
- throw new IllegalArgumentException("arguments is not a uuid");
- }
- return new AddNode_(transactionId, arguments);
- }
-
- /**
- * Adds a node to the index.
- * =
- * @inheritDoc
- */
- @Override
- public void execute(MultiIndex index) throws IOException
- {
- if (doc =3D=3D null)
- {
- try
- {
- doc =3D index.createDocument(uuid);
- }
- catch (RepositoryException e)
- {
- // node does not exist anymore
- log.debug(e.getMessage());
- }
- }
- if (doc !=3D null)
- {
- index.volatileIndex.addDocuments(new Document[]{doc});
- }
- }
-
- /**
- * @inheritDoc
- */
- @Override
- public String toString()
- {
- StringBuffer logLine =3D new StringBuffer(ENTRY_LENGTH);
- logLine.append(Long.toString(getTransactionId()));
- logLine.append(' ');
- logLine.append(Action.ADD_NODE);
- logLine.append(' ');
- logLine.append(uuid);
- return logLine.toString();
- }
- }
-
- /**
- * Commits a transaction.
- */
- private static class Commit_ extends Action
- {
-
- /**
- * Creates a new Commit action.
- * =
- * @param transactionId
- * the id of the transaction that is committed.
- */
- Commit_(long transactionId)
- {
- super(transactionId, Action.TYPE_COMMIT);
- }
-
- /**
- * Creates a new Commit action.
- * =
- * @param transactionId
- * the id of the transaction that executes this action.
- * @param arguments
- * ignored by this method.
- * @return the Commit action.
- */
- static Commit_ fromString(long transactionId, String arguments)
- {
- return new Commit_(transactionId);
- }
-
- /**
- * Touches the last flush time (sets it to the current time).
- * =
- * @inheritDoc
- */
- @Override
- public void execute(MultiIndex index) throws IOException
- {
- index.lastFlushTime =3D System.currentTimeMillis();
- }
-
- /**
- * @inheritDoc
- */
- @Override
- public String toString()
- {
- return Long.toString(getTransactionId()) + ' ' + Action.COMMIT;
- }
- }
-
- /**
- * Creates an new sub index but does not add it to the active persistent
- * index list.
- */
- private static class CreateIndex_ extends Action
- {
-
- /**
- * The name of the index to add.
- */
- private String indexName;
-
- /**
- * Creates a new CreateIndex action.
- * =
- * @param transactionId
- * the id of the transaction that executes this action.
- * @param indexName
- * the name of the index to add, or null
if =
an
- * index with a new name should be created.
- */
- CreateIndex_(long transactionId, String indexName)
- {
- super(transactionId, Action.TYPE_CREATE_INDEX);
- this.indexName =3D indexName;
- }
-
- /**
- * Creates a new CreateIndex action.
- * =
- * @param transactionId
- * the id of the transaction that executes this action.
- * @param arguments
- * the name of the index to create.
- * @return the AddIndex action.
- * @throws IllegalArgumentException
- * if the arguments are malformed.
- */
- static CreateIndex_ fromString(long transactionId, String arguments)
- {
- // when created from String, this action is executed as redo acti=
on
- return new CreateIndex_(transactionId, arguments);
- }
-
- /**
- * Creates a new index.
- * =
- * @inheritDoc
- */
- @Override
- public void execute(MultiIndex index) throws IOException
- {
- PersistentIndex idx =3D index.getOrCreateIndex(indexName);
- indexName =3D idx.getName();
- }
-
- /**
- * @inheritDoc
- */
- @Override
- public void undo(MultiIndex index) throws IOException
- {
- if (index.hasIndex(indexName))
- {
- PersistentIndex idx =3D index.getOrCreateIndex(indexName);
- idx.close();
- index.deleteIndex(idx);
- }
- }
-
- /**
- * @inheritDoc
- */
- @Override
- public String toString()
- {
- StringBuffer logLine =3D new StringBuffer();
- logLine.append(Long.toString(getTransactionId()));
- logLine.append(' ');
- logLine.append(Action.CREATE_INDEX);
- logLine.append(' ');
- logLine.append(indexName);
- return logLine.toString();
- }
-
- /**
- * Returns the index name that has been created. If this method is
- * called before {@link #execute(MultiIndex)} it will return
- * null
.
- * =
- * @return the name of the index that has been created.
- */
- String getIndexName()
- {
- return indexName;
- }
- }
-
- /**
- * Closes and deletes an index that is no longer in use.
- */
- private static class DeleteIndex_ extends Action
- {
-
- /**
- * The name of the index to add.
- */
- private String indexName;
-
- /**
- * Creates a new DeleteIndex action.
- * =
- * @param transactionId
- * the id of the transaction that executes this action.
- * @param indexName
- * the name of the index to delete.
- */
- DeleteIndex_(long transactionId, String indexName)
- {
- super(transactionId, Action.TYPE_DELETE_INDEX);
- this.indexName =3D indexName;
- }
-
- /**
- * Creates a new DeleteIndex action.
- * =
- * @param transactionId
- * the id of the transaction that executes this action.
- * @param arguments
- * the name of the index to delete.
- * @return the DeleteIndex action.
- * @throws IllegalArgumentException
- * if the arguments are malformed.
- */
- static DeleteIndex_ fromString(long transactionId, String arguments)
- {
- return new DeleteIndex_(transactionId, arguments);
- }
-
- /**
- * Removes a sub index from index
.
- * =
- * @inheritDoc
- */
- @Override
- public void execute(MultiIndex index) throws IOException
- {
- // get index if it exists
- for (Iterator it =3D index.indexes.iterator(); it.hasNext();)
- {
- PersistentIndex idx =3D (PersistentIndex)it.next();
- if (idx.getName().equals(indexName))
- {
- idx.close();
- index.deleteIndex(idx);
- break;
- }
- }
- }
-
- /**
- * @inheritDoc
- */
- @Override
- public String toString()
- {
- StringBuffer logLine =3D new StringBuffer();
- logLine.append(Long.toString(getTransactionId()));
- logLine.append(' ');
- logLine.append(Action.DELETE_INDEX);
- logLine.append(' ');
- logLine.append(indexName);
- return logLine.toString();
- }
- }
-
- /**
- * Deletes a node from the index.
- */
- private static class DeleteNode_ extends Action
- {
-
- /**
- * The maximum length of a DeleteNode String.
- */
- private static final int ENTRY_LENGTH =3D
- Long.toString(Long.MAX_VALUE).length() + Action.DELETE_NODE.lengt=
h() + Constants.UUID_FORMATTED_LENGTH + 2;
-
- /**
- * The uuid of the node to remove.
- */
- private final String uuid;
-
- /**
- * Creates a new DeleteNode action.
- * =
- * @param transactionId
- * the id of the transaction that executes this action.
- * @param uuid
- * the uuid of the node to delete.
- */
- DeleteNode_(long transactionId, String uuid)
- {
- super(transactionId, Action.TYPE_DELETE_NODE);
- this.uuid =3D uuid;
- }
-
- /**
- * Creates a new DeleteNode action.
- * =
- * @param transactionId
- * the id of the transaction that executes this action.
- * @param arguments
- * the uuid of the node to delete.
- * @return the DeleteNode action.
- * @throws IllegalArgumentException
- * if the arguments are malformed. Not a UUID.
- */
- static DeleteNode_ fromString(long transactionId, String arguments)
- {
- // simple length check
- if (arguments.length() !=3D Constants.UUID_FORMATTED_LENGTH)
- {
- throw new IllegalArgumentException("arguments is not a uuid");
- }
- return new DeleteNode_(transactionId, arguments);
- }
-
- /**
- * Deletes a node from the index.
- * =
- * @inheritDoc
- */
- @Override
- public void execute(MultiIndex index) throws IOException
- {
- String uuidString =3D uuid.toString();
- // check if indexing queue is still working on
- // this node from a previous update
- Document doc =3D index.indexingQueue.removeDocument(uuidString);
- if (doc !=3D null)
- {
- Util.disposeDocument(doc);
- }
- Term idTerm =3D new Term(FieldNames.UUID, uuidString);
- // if the document cannot be deleted from the volatile index
- // delete it from one of the persistent indexes.
- int num =3D index.volatileIndex.removeDocument(idTerm);
- if (num =3D=3D 0)
- {
- for (int i =3D index.indexes.size() - 1; i >=3D 0; i--)
- {
- // only look in registered indexes
- PersistentIndex idx =3D (PersistentIndex)index.indexes.get(=
i);
- if (index.indexNames.contains(idx.getName()))
- {
- num =3D idx.removeDocument(idTerm);
- if (num > 0)
- {
- return;
- }
- }
- }
- }
- }
-
- /**
- * @inheritDoc
- */
- @Override
- public String toString()
- {
- StringBuffer logLine =3D new StringBuffer(ENTRY_LENGTH);
- logLine.append(Long.toString(getTransactionId()));
- logLine.append(' ');
- logLine.append(Action.DELETE_NODE);
- logLine.append(' ');
- logLine.append(uuid);
- return logLine.toString();
- }
- }
-
- /**
- * Starts a transaction.
- */
- private static class Start_ extends Action
- {
-
- /**
- * Creates a new Start transaction action.
- * =
- * @param transactionId
- * the id of the transaction that started.
- */
- Start_(long transactionId)
- {
- super(transactionId, Action.TYPE_START);
- }
-
- /**
- * Creates a new Start action.
- * =
- * @param transactionId
- * the id of the transaction that executes this action.
- * @param arguments
- * ignored by this method.
- * @return the Start action.
- */
- static Start_ fromString(long transactionId, String arguments)
- {
- return new Start_(transactionId);
- }
-
- /**
- * Sets the current transaction id on index
.
- * =
- * @inheritDoc
- */
- @Override
- public void execute(MultiIndex index) throws IOException
- {
- index.currentTransactionId =3D getTransactionId();
- }
-
- /**
- * @inheritDoc
- */
- @Override
- public String toString()
- {
- return Long.toString(getTransactionId()) + ' ' + Action.START;
- }
- }
-
- /**
- * Commits the volatile index to disk.
- */
- private static class VolatileCommit_ extends Action
- {
-
- /**
- * The name of the target index to commit to.
- */
- private final String targetIndex;
-
- /**
- * Creates a new VolatileCommit action.
- * =
- * @param transactionId
- * the id of the transaction that executes this action.
- */
- VolatileCommit_(long transactionId, String targetIndex)
- {
- super(transactionId, Action.TYPE_VOLATILE_COMMIT);
- this.targetIndex =3D targetIndex;
- }
-
- /**
- * Creates a new VolatileCommit action.
- * =
- * @param transactionId
- * the id of the transaction that executes this action.
- * @param arguments
- * ignored by this implementation.
- * @return the VolatileCommit action.
- */
- static VolatileCommit_ fromString(long transactionId, String argumen=
ts)
- {
- return new VolatileCommit_(transactionId, arguments);
- }
-
- /**
- * Commits the volatile index to disk.
- * =
- * @inheritDoc
- */
- @Override
- public void execute(MultiIndex index) throws IOException
- {
- VolatileIndex volatileIndex =3D index.getVolatileIndex();
- PersistentIndex persistentIndex =3D index.getOrCreateIndex(target=
Index);
- persistentIndex.copyIndex(volatileIndex);
- index.resetVolatileIndex();
- }
-
- /**
- * @inheritDoc
- */
- @Override
- public String toString()
- {
- StringBuffer logLine =3D new StringBuffer();
- logLine.append(Long.toString(getTransactionId()));
- logLine.append(' ');
- logLine.append(Action.VOLATILE_COMMIT);
- logLine.append(' ');
- logLine.append(targetIndex);
- return logLine.toString();
- }
- }
-
- /**
* @see org.exoplatform.services.jcr.impl.core.query.IndexerIoModeListe=
ner#onChangeMode(org.exoplatform.services.jcr.impl.core.query.IndexerIoMode)
*/
public void onChangeMode(IndexerIoMode mode)
@@ -2626,7 +1658,6 @@
// try to stop merger in safe way
flushTask.cancel();
FLUSH_TIMER.purge();
- this.redoLog =3D null;
}
=
/**
@@ -2644,21 +1675,12 @@
releaseMultiReader();
}
=
- this.redoLog =3D new RedoLog(indexDir);
- redoLogApplied =3D redoLog.hasEntries();
-
- // run recovery
- Recovery.run(this, redoLog);
-
// enqueue unused segments for deletion
enqueueUnusedSegments();
attemptDelete();
=
// now that we are ready, start index merger
- if (redoLogApplied)
- {
- flush();
- }
+ flush();
=
if (indexNames.size() > 0)
{
@@ -2749,4 +1771,10 @@
}
}
}
+
+ @Deprecated
+ public boolean getRedoLogApplied()
+ {
+ return false;
+ }
}
Deleted: jcr/branches/1.14-CNK/exo.jcr.component.core/src/main/java/org/exo=
platform/services/jcr/impl/core/query/lucene/Recovery.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/exo.jcr.component.core/src/main/java/org/exoplatf=
orm/services/jcr/impl/core/query/lucene/Recovery.java 2010-10-08 12:39:11 U=
TC (rev 3263)
+++ jcr/branches/1.14-CNK/exo.jcr.component.core/src/main/java/org/exoplatf=
orm/services/jcr/impl/core/query/lucene/Recovery.java 2010-10-08 13:03:55 U=
TC (rev 3264)
@@ -1,203 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.exoplatform.services.jcr.impl.core.query.lucene;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Implements the recovery process.
- */
-class Recovery
-{
-
- /**
- * The logger instance for this class.
- */
- private static final Logger log =3D LoggerFactory.getLogger("exo.jcr.co=
mponent.core.Recovery");
-
- /**
- * The MultiIndex where to run the recovery on.
- */
- private final MultiIndex index;
-
- /**
- * The redo redoLog.
- */
- private final RedoLog redoLog;
-
- /**
- * The ids of the uncommitted transactions. Set of Integer objects.
- */
- private final Set losers =3D new HashSet();
-
- /**
- * Creates a new Recovery instance.
- *
- * @param index the MultiIndex to recover.
- * @param redoLog the redo redoLog.
- */
- private Recovery(MultiIndex index, RedoLog redoLog)
- {
- this.index =3D index;
- this.redoLog =3D redoLog;
- }
-
- /**
- * Runs a recovery on index
if redoLog
contai=
ns
- * log entries.
- *
- * If recovery succeeds the index
is flushed and the redo =
log
- * is cleared. That is, the index
is stable.
- * If recovery fails an IOException is thrown, and the redo log will not
- * be modified. The recovery process can then be executed again, after
- * fixing the cause of the IOException (e.g. disk full).
- *
- * @param index the index to recover.
- * @param redoLog the redo log.
- * @throws IOException if the recovery fails.
- */
- static void run(MultiIndex index, RedoLog redoLog) throws IOException
- {
- if (!redoLog.hasEntries())
- {
- log.debug("RedoLog is empty, no recovery needed.");
- return;
- }
- log.info("Found uncommitted redo log. Applying changes now...");
- Recovery r =3D new Recovery(index, redoLog);
- r.run();
- log.info("Redo changes applied.");
- }
-
- /**
- * Runs the recovery process.
- *
- * @throws IOException if the recovery fails.
- */
- private void run() throws IOException
- {
- List actions =3D redoLog.getActions();
-
- // find loser transactions
- for (Iterator it =3D actions.iterator(); it.hasNext();)
- {
- MultiIndex.Action a =3D (MultiIndex.Action)it.next();
- if (a.getType() =3D=3D MultiIndex.Action.TYPE_START)
- {
- losers.add(new Long(a.getTransactionId()));
- }
- else if (a.getType() =3D=3D MultiIndex.Action.TYPE_COMMIT)
- {
- losers.remove(new Long(a.getTransactionId()));
- }
- }
-
- // find last volatile commit without changes from a loser
- int lastSafeVolatileCommit =3D -1;
- Set transactionIds =3D new HashSet();
- for (int i =3D 0; i < actions.size(); i++)
- {
- MultiIndex.Action a =3D (MultiIndex.Action)actions.get(i);
- if (a.getType() =3D=3D MultiIndex.Action.TYPE_COMMIT)
- {
- transactionIds.clear();
- }
- else if (a.getType() =3D=3D MultiIndex.Action.TYPE_VOLATILE_COMMI=
T)
- {
- transactionIds.retainAll(losers);
- // check if transactionIds contains losers
- if (transactionIds.size() > 0)
- {
- // found dirty volatile commit
- break;
- }
- else
- {
- lastSafeVolatileCommit =3D i;
- }
- }
- else
- {
- transactionIds.add(new Long(a.getTransactionId()));
- }
- }
-
- // delete dirty indexes
- for (int i =3D lastSafeVolatileCommit + 1; i < actions.size(); i++)
- {
- MultiIndex.Action a =3D (MultiIndex.Action)actions.get(i);
- if (a.getType() =3D=3D MultiIndex.Action.TYPE_CREATE_INDEX)
- {
- a.undo(index);
- }
- }
-
- // replay actions up to last safe volatile commit
- // ignore add node actions, they are included in volatile commits
- for (int i =3D 0; i < actions.size() && i <=3D lastSafeVolatileCommi=
t; i++)
- {
- MultiIndex.Action a =3D (MultiIndex.Action)actions.get(i);
- switch (a.getType())
- {
- case MultiIndex.Action.TYPE_ADD_INDEX :
- case MultiIndex.Action.TYPE_CREATE_INDEX :
- case MultiIndex.Action.TYPE_DELETE_INDEX :
- case MultiIndex.Action.TYPE_DELETE_NODE :
- // ignore actions by the index merger.
- // the previously created index of a merge has been
- // deleted because it was considered dirty.
- // we are conservative here and let the index merger do
- // its work again.
- if (a.getTransactionId() =3D=3D MultiIndex.Action.INTERNAL_=
TRANS_REPL_INDEXES)
- {
- continue;
- }
- a.execute(index);
- }
- }
-
- // now replay the rest until we encounter a loser transaction
- for (int i =3D lastSafeVolatileCommit + 1; i < actions.size(); i++)
- {
- MultiIndex.Action a =3D (MultiIndex.Action)actions.get(i);
- if (losers.contains(new Long(a.getTransactionId())))
- {
- break;
- }
- else
- {
- // ignore actions by the index merger.
- if (a.getTransactionId() =3D=3D MultiIndex.Action.INTERNAL_TRA=
NS_REPL_INDEXES)
- {
- continue;
- }
- a.execute(index);
- }
- }
-
- // now we are consistent again -> flush
- index.flush();
- index.releaseMultiReader();
- }
-}
Deleted: jcr/branches/1.14-CNK/exo.jcr.component.core/src/main/java/org/exo=
platform/services/jcr/impl/core/query/lucene/RedoLog.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.14-CNK/exo.jcr.component.core/src/main/java/org/exoplatf=
orm/services/jcr/impl/core/query/lucene/RedoLog.java 2010-10-08 12:39:11 UT=
C (rev 3263)
+++ jcr/branches/1.14-CNK/exo.jcr.component.core/src/main/java/org/exoplatf=
orm/services/jcr/impl/core/query/lucene/RedoLog.java 2010-10-08 13:03:55 UT=
C (rev 3264)
@@ -1,291 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.exoplatform.services.jcr.impl.core.query.lucene;
-
-import org.apache.lucene.store.Directory;
-import org.exoplatform.services.jcr.impl.core.query.lucene.directory.Index=
InputStream;
-import org.exoplatform.services.jcr.impl.core.query.lucene.directory.Index=
OutputStream;
-import org.exoplatform.services.jcr.impl.util.SecurityHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.security.PrivilegedExceptionAction;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Implements a redo log for changes that have not been committed to disk.=
While
- * nodes are added to and removed from the volatile index (held in memory)=
a
- * redo log is written to keep track of the changes. In case the Jackrabbit
- * process terminates unexpected the redo log is applied when Jackrabbit is
- * restarted the next time.
- *
- * This class is not thread-safe.
- */
-class RedoLog
-{
-
- /**
- * Logger instance for this class
- */
- private static final Logger log =3D LoggerFactory.getLogger("exo.jcr.co=
mponent.core.RedoLog");
-
- /**
- * Default name of the redo log file
- */
- private static final String REDO_LOG =3D "redo.log";
-
- /**
- * Implements a {@link ActionCollector} that counts all entries and sets
- * {@link #entryCount}.
- */
- private final ActionCollector ENTRY_COUNTER =3D new ActionCollector()
- {
- public void collect(MultiIndex.Action a)
- {
- entryCount++;
- }
- };
-
- /**
- * The directory where the log file is stored.
- */
- private final Directory dir;
-
- /**
- * The number of log entries in the log file
- */
- private int entryCount =3D 0;
-
- /**
- * Writer to the log file
- */
- private Writer out;
-
- /**
- * Creates a new RedoLog
instance, which stores its log in=
the
- * given directory.
- *
- * @param dir the directory where the redo log file is located.
- * @throws IOException if an error occurs while reading the redo log.
- */
- RedoLog(Directory dir) throws IOException
- {
- this.dir =3D dir;
- read(ENTRY_COUNTER);
- }
-
- /**
- * Returns true
if this redo log contains any entries,
- * false
otherwise.
- * @return true
if this redo log contains any entries,
- * false
otherwise.
- */
- boolean hasEntries()
- {
- return entryCount > 0;
- }
-
- /**
- * Returns the number of entries in this redo log.
- * @return the number of entries in this redo log.
- */
- int getSize()
- {
- return entryCount;
- }
-
- /**
- * Returns a List with all {@link MultiIndex.Action} instances in the
- * redo log.
- *
- * @return an List with all {@link MultiIndex.Action} instances in the
- * redo log.
- * @throws IOException if an error occurs while reading from the redo l=
og.
- */
- List getActions() throws IOException
- {
- final List actions =3D new ArrayList();
- read(new ActionCollector()
- {
- public void collect(MultiIndex.Action a)
- {
- actions.add(a);
- }
- });
- return actions;
- }
-
- /**
- * Appends an action to the log.
- *
- * @param action the action to append.
- * @throws IOException if the node cannot be written to the redo
- * log.
- */
- void append(final MultiIndex.Action action) throws IOException
- {
- SecurityHelper.doPriviledgedIOExceptionAction(new PrivilegedExceptio=
nAction()
- {
- public Object run() throws Exception
- {
- initOut();
- out.write(action.toString() + "\n");
- entryCount++;
- return null;
- }
- });
- }
-
- /**
- * Flushes all pending writes to the underlying file.
- * @throws IOException if an error occurs while writing.
- */
- void flush() throws IOException
- {
- SecurityHelper.doPriviledgedIOExceptionAction(new PrivilegedExceptio=
nAction()
- {
- public Object run() throws Exception
- {
- if (out !=3D null)
- {
- out.flush();
- }
- return null;
- }
- });
- }
-
- /**
- * Clears the redo log.
- * @throws IOException if the redo log cannot be cleared.
- */
- void clear() throws IOException
- {
- SecurityHelper.doPriviledgedIOExceptionAction(new PrivilegedExceptio=
nAction()
- {
- public Object run() throws Exception
- {
- if (out !=3D null)
- {
- out.close();
- out =3D null;
- }
- if (dir.fileExists(REDO_LOG))
- {
- dir.deleteFile(REDO_LOG);
- }
- entryCount =3D 0;
- return null;
- }
- });
- }
-
- /**
- * Initializes the {@link #out} stream if it is not yet set.
- * @throws IOException if an error occurs while creating the
- * output stream.
- */
- private void initOut() throws IOException
- {
- SecurityHelper.doPriviledgedIOExceptionAction(new PrivilegedExceptio=
nAction()
- {
- public Object run() throws Exception
- {
- if (out =3D=3D null)
- {
- OutputStream os =3D new IndexOutputStream(dir.createOutput(=
REDO_LOG));
- out =3D new BufferedWriter(new OutputStreamWriter(os));
- }
- return null;
- }
- });
- }
-
- /**
- * Reads the log file and calls back {@link RedoLog.ActionCollector}.
- *
- * @param collector called back for each {@link MultiIndex.Action} read.
- * @throws IOException if an error occurs while reading from the
- * log file.
- */
- private void read(final ActionCollector collector) throws IOException
- {
- SecurityHelper.doPriviledgedIOExceptionAction(new PrivilegedExceptio=
nAction()
- {
- public Object run() throws Exception
- {
- if (!dir.fileExists(REDO_LOG))
- {
- return null;
- }
- InputStream in =3D new IndexInputStream(dir.openInput(REDO_LOG=
));
- try
- {
- BufferedReader reader =3D new BufferedReader(new InputStrea=
mReader(in));
- String line;
- while ((line =3D reader.readLine()) !=3D null)
- {
- try
- {
- collector.collect(MultiIndex.Action.fromString(line));
- }
- catch (IllegalArgumentException e)
- {
- log.warn("Malformed redo entry: " + e.getMessage());
- }
- }
- }
- finally
- {
- if (in !=3D null)
- {
- try
- {
- in.close();
- }
- catch (IOException e)
- {
- log.warn("Exception while closing redo log: " + e.toS=
tring());
- }
- }
- }
- return null;
- }
- });
- }
-
- //-----------------------< internal >----------------------------------=
-----
-
- /**
- * Helper interface to collect Actions read from the redo log.
- */
- interface ActionCollector
- {
-
- /** Called when an action is created */
- void collect(MultiIndex.Action action);
- }
-}
--===============7349350063708105368==--
From do-not-reply at jboss.org Fri Oct 8 10:40:50 2010
Content-Type: multipart/mixed; boundary="===============1473433891670044966=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3265 -
kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils.
Date: Fri, 08 Oct 2010 10:40:49 -0400
Message-ID: <201010081440.o98Een9s018726@svn01.web.mwc.hst.phx2.redhat.com>
--===============1473433891670044966==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: sergiykarpenko
Date: 2010-10-08 10:40:49 -0400 (Fri, 08 Oct 2010)
New Revision: 3265
Modified:
kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/ut=
ils/MapResourceBundle.java
Log:
EXOJCR-996: Merge performance improvements
Modified: kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/com=
mons/utils/MapResourceBundle.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/u=
tils/MapResourceBundle.java 2010-10-08 13:03:55 UTC (rev 3264)
+++ kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/u=
tils/MapResourceBundle.java 2010-10-08 14:40:49 UTC (rev 3265)
@@ -1,181 +1,183 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.commons.utils;
-
-import java.io.Serializable;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.Map;
-import java.util.ResourceBundle;
-import java.util.Set;
-import java.util.Vector;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * @author Benjamin Mestrallet benjamin.mestrallet(a)exoplatform.com
- */
-public class MapResourceBundle extends ResourceBundle implements Serializa=
ble
-{
-
- /**
- * The serial version UID
- */
- private static final long serialVersionUID =3D -7020823660841958748L;
-
- private final static String REGEXP =3D "#\\{.*\\}";
-
- private Map props =3D new HashMap();
-
- private Locale locale;
-
- public MapResourceBundle(Locale l)
- {
- this.locale =3D l;
- }
-
- public MapResourceBundle(ResourceBundle rB, Locale l)
- {
- this.locale =3D l;
- initMap(rB);
- }
-
- private void initMap(ResourceBundle rB)
- {
- Enumeration e =3D rB.getKeys();
- while (e.hasMoreElements())
- {
- String s =3D (String)e.nextElement();
- try
- {
- if (props.get(s) =3D=3D null)
- {
- String[] newArray =3D rB.getStringArray(s);
- props.put(s, newArray);
- }
- }
- catch (ClassCastException ex)
- {
- props.put(s, rB.getObject(s));
- }
- }
- }
-
- protected Object handleGetObject(String key)
- {
- return props.get(key);
- }
-
- public Enumeration getKeys()
- {
- return new Vector(props.keySet()).elements();
- }
-
- public Locale getLocale()
- {
- return this.locale;
- }
-
- public void add(String key, Object value)
- {
- props.put(key, value);
- }
-
- public void remove(String key)
- {
- props.remove(key);
- }
-
- public void merge(ResourceBundle bundle)
- {
- Enumeration e =3D bundle.getKeys();
- while (e.hasMoreElements())
- {
- String s =3D (String)e.nextElement();
- Object value =3D bundle.getObject(s);
- try
- {
- String[] newArray =3D bundle.getStringArray(s);
- if (props.get(s) =3D=3D null)
- {
- props.put(s, newArray);
- }
- }
- catch (ClassCastException ex)
- {
- props.put(s, value);
- }
- }
- }
-
- public void resolveDependencies()
- {
- Map tempMap =3D new HashMap(props);
- Set keys =3D tempMap.keySet();
- Pattern pattern =3D Pattern.compile(REGEXP);
- for (Iterator iter =3D keys.iterator(); iter.hasNext();)
- {
- String element =3D (String)iter.next();
- String value =3D lookupKey(tempMap, element, pattern, new HashSet=
());
- tempMap.put(element, value);
- }
- props =3D tempMap;
- }
-
- private String lookupKey(Map props, String key, Pattern pattern, Set callStack)
- {
- String s =3D (String)props.get(key);
- if (s =3D=3D null || callStack.contains(key))
- {
- // The value cannot be found or it has already been asked which m=
eans that
- // a loop has been detected
- return key;
- }
- callStack.add(key);
- Matcher matcher =3D pattern.matcher(s);
- if (matcher.find())
- {
- return recursivedResolving(props, s, pattern, callStack);
- }
- // The value could be resolved thus it can be removed from the callS=
tack
- callStack.remove(key);
- return s;
- }
-
- private String recursivedResolving(Map props, String value, Pattern pat=
tern, Set callStack)
- {
- String resolved =3D value;
- StringBuilder sB =3D new StringBuilder();
- while (resolved.indexOf("#{") !=3D -1)
- {
- sB.setLength(0);
- int firstIndex =3D resolved.indexOf('#');
- int lastIndex =3D resolved.indexOf('}', firstIndex);
- String realKey =3D resolved.substring(firstIndex + 2, lastIndex);
- sB.append(resolved.substring(0, firstIndex));
- sB.append(lookupKey(props, realKey, pattern, callStack));
- sB.append(resolved.substring(lastIndex + 1));
- resolved =3D sB.toString();
- }
- return resolved;
- }
-}
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.commons.utils;
+
+import java.io.Serializable;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+import java.util.ResourceBundle;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * @author Benjamin Mestrallet benjamin.mestrallet(a)exoplatform.com
+ */
+public class MapResourceBundle extends ResourceBundle implements Serializa=
ble
+{
+
+ /**
+ * The serial version UID
+ */
+ private static final long serialVersionUID =3D -7020823660841958748L;
+
+ private final static Pattern PATTERN =3D Pattern.compile("#\\{.*\\}");
+
+ private Map props;
+
+ private Locale locale;
+
+ public MapResourceBundle(Locale l)
+ {
+ this.locale =3D l;
+ this.props =3D new HashMap();
+ }
+
+ public MapResourceBundle(ResourceBundle rB, Locale l)
+ {
+ Map props =3D new HashMap();
+ doMerge(props, rB);
+
+ //
+ this.locale =3D l;
+ this.props =3D props;
+ }
+
+ private static void doMerge(Map props, ResourceBundle r=
B)
+ {
+ Enumeration e =3D rB.getKeys();
+ while (e.hasMoreElements())
+ {
+ String key =3D e.nextElement();
+ if (props.get(key) =3D=3D null)
+ {
+ Object o =3D rB.getObject(key);
+ if (o instanceof String)
+ {
+ String value =3D (String)o;
+ props.put(key.intern(), value.intern());
+ }
+ }
+ }
+ }
+
+ protected Object handleGetObject(String key)
+ {
+ return props.get(key);
+ }
+
+ public Enumeration getKeys()
+ {
+ final Iterator i =3D props.keySet().iterator();
+ return new Enumeration()
+ {
+ public boolean hasMoreElements()
+ {
+ return i.hasNext();
+ }
+ public String nextElement()
+ {
+ return i.next();
+ }
+ };
+ }
+
+ public Locale getLocale()
+ {
+ return this.locale;
+ }
+
+ public void add(String key, Object o)
+ {
+ if (key !=3D null && o instanceof String)
+ {
+ String value =3D (String)o;
+ props.put(key.intern(), value.intern());
+ }
+ }
+
+ public void remove(String key)
+ {
+ if (key !=3D null)
+ {
+ props.remove(key);
+ }
+ }
+
+ public void merge(ResourceBundle bundle)
+ {
+ doMerge(props, bundle);
+ }
+
+ public void resolveDependencies()
+ {
+ Map tempMap =3D new HashMap(props);
+ for (String element : props.keySet())
+ {
+ String value =3D lookupKey(tempMap, element, new HashSet(=
));
+ if (value !=3D null)
+ {
+ tempMap.put(element.intern(), value.intern());
+ }
+ }
+ props =3D tempMap;
+ }
+
+ private String lookupKey(Map props, String key, Set callStack)
+ {
+ String s =3D props.get(key);
+ if (s =3D=3D null || callStack.contains(key))
+ {
+ // The value cannot be found or it has already been asked which m=
eans that
+ // a loop has been detected
+ return key;
+ }
+ callStack.add(key);
+ Matcher matcher =3D PATTERN.matcher(s);
+ if (matcher.find())
+ {
+ return recursivedResolving(props, s, callStack);
+ }
+ // The value could be resolved thus it can be removed from the callS=
tack
+ callStack.remove(key);
+ return s;
+ }
+
+ private String recursivedResolving(Map props, String value, Set=
callStack)
+ {
+ String resolved =3D value;
+ StringBuilder sB =3D new StringBuilder();
+ while (resolved.indexOf("#{") !=3D -1)
+ {
+ sB.setLength(0);
+ int firstIndex =3D resolved.indexOf('#');
+ int lastIndex =3D resolved.indexOf('}', firstIndex);
+ String realKey =3D resolved.substring(firstIndex + 2, lastIndex);
+ sB.append(resolved.substring(0, firstIndex));
+ sB.append(lookupKey(props, realKey, callStack));
+ sB.append(resolved.substring(lastIndex + 1));
+ resolved =3D sB.toString();
+ }
+ return resolved;
+ }
+}
--===============1473433891670044966==--
From do-not-reply at jboss.org Fri Oct 8 11:24:49 2010
Content-Type: multipart/mixed; boundary="===============0272578606694077470=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3266 - in
kernel/trunk/exo.kernel.component.common/src:
main/java/org/exoplatform/services/rpc/impl and 1 other directories.
Date: Fri, 08 Oct 2010 11:24:49 -0400
Message-ID: <201010081524.o98FOn6S027057@svn01.web.mwc.hst.phx2.redhat.com>
--===============0272578606694077470==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: nfilotto
Date: 2010-10-08 11:24:49 -0400 (Fri, 08 Oct 2010)
New Revision: 3266
Modified:
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/s=
ervices/rpc/RPCService.java
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/s=
ervices/rpc/impl/RPCServiceImpl.java
kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/s=
ervices/rpc/impl/TestRPCServiceImpl.java
Log:
EXOJCR-967: The method isCoordinator has been added
Modified: kernel/trunk/exo.kernel.component.common/src/main/java/org/exopla=
tform/services/rpc/RPCService.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/=
services/rpc/RPCService.java 2010-10-08 14:40:49 UTC (rev 3265)
+++ kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/=
services/rpc/RPCService.java 2010-10-08 15:24:49 UTC (rev 3266)
@@ -124,4 +124,11 @@
* doesn't have the {@link RuntimePermission} ACCESS_RPC_SERVICE_=
PERMISSION
*/
void unregisterCommand(RemoteCommand command) throws SecurityException;
+ =
+ /**
+ * Indicates whether the local node is the coordinator of the cluster
+ * @return true
if the coordinator is the coordinator, false otherwise
+ * throws RPCException in case the {@link RPCService} is in an illegal =
state
+ */
+ boolean isCoordinator() throws RPCException; =
}
\ No newline at end of file
Modified: kernel/trunk/exo.kernel.component.common/src/main/java/org/exopla=
tform/services/rpc/impl/RPCServiceImpl.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/=
services/rpc/impl/RPCServiceImpl.java 2010-10-08 14:40:49 UTC (rev 3265)
+++ kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/=
services/rpc/impl/RPCServiceImpl.java 2010-10-08 15:24:49 UTC (rev 3266)
@@ -130,6 +130,11 @@
protected volatile Address coordinator;
=
/**
+ * Indicates whether the current node is the coordinator of the cluster=
or not
+ */
+ protected volatile boolean isCoordinator;
+ =
+ /**
* The default value of the timeout
*/
private long defaultTimeout =3D DEFAULT_TIMEOUT;
@@ -430,6 +435,7 @@
{
this.members =3D view.getMembers();
this.coordinator =3D members !=3D null && members.size() > 0 ? membe=
rs.get(0) : null;
+ this.isCoordinator =3D coordinator !=3D null && coordinator.equals(c=
hannel.getLocalAddress());
}
=
/**
@@ -498,6 +504,19 @@
}
=
/**
+ * {@inheritDoc}
+ */
+ public boolean isCoordinator() throws RPCException
+ {
+ if (state !=3D State.STARTED)
+ {
+ throw new RPCException("Cannot know whether the local node is a c=
oordinator or not if " +
+ "the service is not started, the current state of the service i=
s " + state);
+ }
+ return isCoordinator;
+ }
+
+ /**
* Gives the {@link RemoteCommand} corresponding to the given id
* @param commandId the command id of the command to retrieve
* @return the corresponding {@link RemoteCommand}
@@ -553,6 +572,7 @@
security.checkPermission(RPCService.ACCESS_RPC_SERVICE_PERMISSION=
);
}
this.state =3D State.STOPPED;
+ this.isCoordinator =3D false;
if (channel !=3D null && channel.isOpen())
{
if (LOG.isInfoEnabled())
Modified: kernel/trunk/exo.kernel.component.common/src/test/java/org/exopla=
tform/services/rpc/impl/TestRPCServiceImpl.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/=
services/rpc/impl/TestRPCServiceImpl.java 2010-10-08 14:40:49 UTC (rev 3265)
+++ kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/=
services/rpc/impl/TestRPCServiceImpl.java 2010-10-08 15:24:49 UTC (rev 3266)
@@ -221,7 +221,17 @@
{
// OK
}
+ try
+ {
+ service.isCoordinator();
+ fail("We expect a RPCException since the current state is not =
the expected one");
+ }
+ catch (RPCException e)
+ {
+ // OK
+ }
service.start();
+ assertEquals(true, service.isCoordinator());
service.executeCommandOnAllNodes(foo, true);
service.executeCommandOnAllNodes(foo, 10);
service.executeCommandOnCoordinator(foo, true);
@@ -668,6 +678,8 @@
service2.registerCommand(LongTask); =
service1.start();
service2.start();
+ assertEquals(true, service1.isCoordinator());
+ assertEquals(false, service2.isCoordinator());
List result;
Object o;
result =3D service1.executeCommandOnAllNodes(CmdUnknownOnNode2, t=
rue);
@@ -739,6 +751,16 @@
assertNotNull(result);
assertTrue(result.size() =3D=3D 1);
assertTrue("We expect an RPCException due to a member that has le=
ft", result.get(0) instanceof MemberHasLeftException);
+ try
+ {
+ service1.isCoordinator();
+ fail("We expect a RPCException since the current state is not =
the expected one");
+ }
+ catch (RPCException e)
+ {
+ // OK
+ }
+ assertEquals(true, service2.isCoordinator()); =
}
finally
{
--===============0272578606694077470==--
From do-not-reply at jboss.org Fri Oct 8 15:42:07 2010
Content-Type: multipart/mixed; boundary="===============9047510335307984095=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3267 - kernel/branches/2.2.x.
Date: Fri, 08 Oct 2010 15:42:06 -0400
Message-ID: <201010081942.o98Jg6p8030224@svn01.web.mwc.hst.phx2.redhat.com>
--===============9047510335307984095==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: aheritier
Date: 2010-10-08 15:42:06 -0400 (Fri, 08 Oct 2010)
New Revision: 3267
Modified:
kernel/branches/2.2.x/pom.xml
Log:
[maven-release-plugin] prepare branch 2.2.5-GA_REL
Modified: kernel/branches/2.2.x/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/branches/2.2.x/pom.xml 2010-10-08 15:24:49 UTC (rev 3266)
+++ kernel/branches/2.2.x/pom.xml 2010-10-08 19:42:06 UTC (rev 3267)
@@ -43,9 +43,9 @@
=
- scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/kernel/br=
anches/2.2.x/
- scm:svn:https://svn.jboss.org/repos/exo-jcr/ker=
nel/branches/2.2.x/
- http://fisheye.jboss.org/browse/exo-jcr/kernel/branches/2.2.x=
url>
+ scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/kernel/br=
anches/2.2.5-GA_REL
+ scm:svn:https://svn.jboss.org/repos/exo-jcr/ker=
nel/branches/2.2.5-GA_REL
+ http://fisheye.jboss.org/browse/exo-jcr/kernel/branches/2.2.5-G=
A_REL
=
--===============9047510335307984095==--
From do-not-reply at jboss.org Fri Oct 8 15:42:30 2010
Content-Type: multipart/mixed; boundary="===============0254982006854175668=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3268 - kernel/branches.
Date: Fri, 08 Oct 2010 15:42:30 -0400
Message-ID: <201010081942.o98JgUQk030235@svn01.web.mwc.hst.phx2.redhat.com>
--===============0254982006854175668==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: aheritier
Date: 2010-10-08 15:42:30 -0400 (Fri, 08 Oct 2010)
New Revision: 3268
Added:
kernel/branches/2.2.5-GA_REL/
Log:
[maven-release-plugin] copy for branch 2.2.5-GA_REL
Copied: kernel/branches/2.2.5-GA_REL (from rev 3267, kernel/branches/2.2.x)
--===============0254982006854175668==--
From do-not-reply at jboss.org Fri Oct 8 15:43:00 2010
Content-Type: multipart/mixed; boundary="===============2341798383672823737=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3269 - in kernel/branches/2.2.x:
exo.kernel.commons and 12 other directories.
Date: Fri, 08 Oct 2010 15:43:00 -0400
Message-ID: <201010081943.o98Jh0qm030249@svn01.web.mwc.hst.phx2.redhat.com>
--===============2341798383672823737==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: aheritier
Date: 2010-10-08 15:43:00 -0400 (Fri, 08 Oct 2010)
New Revision: 3269
Modified:
kernel/branches/2.2.x/exo.kernel.commons/pom.xml
kernel/branches/2.2.x/exo.kernel.component.cache/pom.xml
kernel/branches/2.2.x/exo.kernel.component.command/pom.xml
kernel/branches/2.2.x/exo.kernel.component.common/pom.xml
kernel/branches/2.2.x/exo.kernel.component.ext.cache.impl.jboss.v3/pom.x=
ml
kernel/branches/2.2.x/exo.kernel.component.remote/pom.xml
kernel/branches/2.2.x/exo.kernel.container/pom.xml
kernel/branches/2.2.x/exo.kernel.mc-integration/exo.kernel.mc-int-demo/p=
om.xml
kernel/branches/2.2.x/exo.kernel.mc-integration/exo.kernel.mc-int-tests/=
pom.xml
kernel/branches/2.2.x/exo.kernel.mc-integration/exo.kernel.mc-int/pom.xml
kernel/branches/2.2.x/exo.kernel.mc-integration/exo.kernel.mc-kernel-ext=
ras/pom.xml
kernel/branches/2.2.x/exo.kernel.mc-integration/pom.xml
kernel/branches/2.2.x/packaging/module/pom.xml
kernel/branches/2.2.x/pom.xml
Log:
[maven-release-plugin] prepare release 2.2.5-GA_REL
Modified: kernel/branches/2.2.x/exo.kernel.commons/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/branches/2.2.x/exo.kernel.commons/pom.xml 2010-10-08 19:42:30 UT=
C (rev 3268)
+++ kernel/branches/2.2.x/exo.kernel.commons/pom.xml 2010-10-08 19:43:00 UT=
C (rev 3269)
@@ -25,7 +25,7 @@
org.exoplatform.kernel
kernel-parent
- 2.2.5-GA-SNAPSHOT
+ 2.2.6-GA-SNAPSHOT
=
exo.kernel.commons
Modified: kernel/branches/2.2.x/exo.kernel.component.cache/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/branches/2.2.x/exo.kernel.component.cache/pom.xml 2010-10-08 19:=
42:30 UTC (rev 3268)
+++ kernel/branches/2.2.x/exo.kernel.component.cache/pom.xml 2010-10-08 19:=
43:00 UTC (rev 3269)
@@ -25,7 +25,7 @@
org.exoplatform.kernel
kernel-parent
- 2.2.5-GA-SNAPSHOT
+ 2.2.6-GA-SNAPSHOT
=
exo.kernel.component.cache
Modified: kernel/branches/2.2.x/exo.kernel.component.command/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/branches/2.2.x/exo.kernel.component.command/pom.xml 2010-10-08 1=
9:42:30 UTC (rev 3268)
+++ kernel/branches/2.2.x/exo.kernel.component.command/pom.xml 2010-10-08 1=
9:43:00 UTC (rev 3269)
@@ -25,7 +25,7 @@
org.exoplatform.kernel
kernel-parent
- 2.2.5-GA-SNAPSHOT
+ 2.2.6-GA-SNAPSHOT
=
exo.kernel.component.command
Modified: kernel/branches/2.2.x/exo.kernel.component.common/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/branches/2.2.x/exo.kernel.component.common/pom.xml 2010-10-08 19=
:42:30 UTC (rev 3268)
+++ kernel/branches/2.2.x/exo.kernel.component.common/pom.xml 2010-10-08 19=
:43:00 UTC (rev 3269)
@@ -25,7 +25,7 @@
org.exoplatform.kernel
kernel-parent
- 2.2.5-GA-SNAPSHOT
+ 2.2.6-GA-SNAPSHOT
=
exo.kernel.component.common
Modified: kernel/branches/2.2.x/exo.kernel.component.ext.cache.impl.jboss.v=
3/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/branches/2.2.x/exo.kernel.component.ext.cache.impl.jboss.v3/pom.=
xml 2010-10-08 19:42:30 UTC (rev 3268)
+++ kernel/branches/2.2.x/exo.kernel.component.ext.cache.impl.jboss.v3/pom.=
xml 2010-10-08 19:43:00 UTC (rev 3269)
@@ -23,7 +23,7 @@
org.exoplatform.kernel
kernel-parent
- 2.2.5-GA-SNAPSHOT
+ 2.2.6-GA-SNAPSHOT
exo.kernel.component.ext.cache.impl.jboss.v3
eXo Kernel :: Cache Extension :: JBoss Cache Implementation
Modified: kernel/branches/2.2.x/exo.kernel.component.remote/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/branches/2.2.x/exo.kernel.component.remote/pom.xml 2010-10-08 19=
:42:30 UTC (rev 3268)
+++ kernel/branches/2.2.x/exo.kernel.component.remote/pom.xml 2010-10-08 19=
:43:00 UTC (rev 3269)
@@ -25,7 +25,7 @@
org.exoplatform.kernel
kernel-parent
- 2.2.5-GA-SNAPSHOT
+ 2.2.6-GA-SNAPSHOT
=
exo.kernel.component.remote
Modified: kernel/branches/2.2.x/exo.kernel.container/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/branches/2.2.x/exo.kernel.container/pom.xml 2010-10-08 19:42:30 =
UTC (rev 3268)
+++ kernel/branches/2.2.x/exo.kernel.container/pom.xml 2010-10-08 19:43:00 =
UTC (rev 3269)
@@ -12,7 +12,7 @@
org.exoplatform.kernel
kernel-parent
- 2.2.5-GA-SNAPSHOT
+ 2.2.6-GA-SNAPSHOT
exo.kernel.container
eXo Kernel :: Container
Modified: kernel/branches/2.2.x/exo.kernel.mc-integration/exo.kernel.mc-int=
/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/branches/2.2.x/exo.kernel.mc-integration/exo.kernel.mc-int/pom.x=
ml 2010-10-08 19:42:30 UTC (rev 3268)
+++ kernel/branches/2.2.x/exo.kernel.mc-integration/exo.kernel.mc-int/pom.x=
ml 2010-10-08 19:43:00 UTC (rev 3269)
@@ -6,7 +6,7 @@
org.exoplatform.kernel
mc-integration-parent
- 2.2.5-GA-SNAPSHOT
+ 2.2.6-GA-SNAPSHOT
=
exo.kernel.mc-int
Modified: kernel/branches/2.2.x/exo.kernel.mc-integration/exo.kernel.mc-int=
-demo/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/branches/2.2.x/exo.kernel.mc-integration/exo.kernel.mc-int-demo/=
pom.xml 2010-10-08 19:42:30 UTC (rev 3268)
+++ kernel/branches/2.2.x/exo.kernel.mc-integration/exo.kernel.mc-int-demo/=
pom.xml 2010-10-08 19:43:00 UTC (rev 3269)
@@ -5,7 +5,7 @@
org.exoplatform.kernel
mc-integration-parent
- 2.2.5-GA-SNAPSHOT
+ 2.2.6-GA-SNAPSHOT
=
exo.kernel.mc-int-demo
Modified: kernel/branches/2.2.x/exo.kernel.mc-integration/exo.kernel.mc-int=
-tests/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/branches/2.2.x/exo.kernel.mc-integration/exo.kernel.mc-int-tests=
/pom.xml 2010-10-08 19:42:30 UTC (rev 3268)
+++ kernel/branches/2.2.x/exo.kernel.mc-integration/exo.kernel.mc-int-tests=
/pom.xml 2010-10-08 19:43:00 UTC (rev 3269)
@@ -5,7 +5,7 @@
org.exoplatform.kernel
mc-integration-parent
- 2.2.5-GA-SNAPSHOT
+ 2.2.6-GA-SNAPSHOT
=
exo.kernel.mc-int-tests
Modified: kernel/branches/2.2.x/exo.kernel.mc-integration/exo.kernel.mc-ker=
nel-extras/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/branches/2.2.x/exo.kernel.mc-integration/exo.kernel.mc-kernel-ex=
tras/pom.xml 2010-10-08 19:42:30 UTC (rev 3268)
+++ kernel/branches/2.2.x/exo.kernel.mc-integration/exo.kernel.mc-kernel-ex=
tras/pom.xml 2010-10-08 19:43:00 UTC (rev 3269)
@@ -6,7 +6,7 @@
org.exoplatform.kernel
mc-integration-parent
- 2.2.5-GA-SNAPSHOT
+ 2.2.6-GA-SNAPSHOT
=
exo.kernel.mc-kernel-extras
Modified: kernel/branches/2.2.x/exo.kernel.mc-integration/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/branches/2.2.x/exo.kernel.mc-integration/pom.xml 2010-10-08 19:4=
2:30 UTC (rev 3268)
+++ kernel/branches/2.2.x/exo.kernel.mc-integration/pom.xml 2010-10-08 19:4=
3:00 UTC (rev 3269)
@@ -6,7 +6,7 @@
org.exoplatform.kernel
kernel-parent
- 2.2.5-GA-SNAPSHOT
+ 2.2.6-GA-SNAPSHOT
=
mc-integration-parent
Modified: kernel/branches/2.2.x/packaging/module/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/branches/2.2.x/packaging/module/pom.xml 2010-10-08 19:42:30 UTC =
(rev 3268)
+++ kernel/branches/2.2.x/packaging/module/pom.xml 2010-10-08 19:43:00 UTC =
(rev 3269)
@@ -2,7 +2,7 @@
org.exoplatform.kernel
kernel-parent
- 2.2.5-GA-SNAPSHOT
+ 2.2.6-GA-SNAPSHOT
=
4.0.0
Modified: kernel/branches/2.2.x/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/branches/2.2.x/pom.xml 2010-10-08 19:42:30 UTC (rev 3268)
+++ kernel/branches/2.2.x/pom.xml 2010-10-08 19:43:00 UTC (rev 3269)
@@ -30,7 +30,7 @@
=
org.exoplatform.kernel
kernel-parent
- 2.2.5-GA-SNAPSHOT
+ 2.2.6-GA-SNAPSHOT
pom
=
eXo Kernel
@@ -43,9 +43,9 @@
=
- scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/kernel/br=
anches/2.2.5-GA_REL
- scm:svn:https://svn.jboss.org/repos/exo-jcr/ker=
nel/branches/2.2.5-GA_REL
- http://fisheye.jboss.org/browse/exo-jcr/kernel/branches/2.2.5-G=
A_REL
+ scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/kernel/br=
anches/2.2.x/
+ scm:svn:https://svn.jboss.org/repos/exo-jcr/ker=
nel/branches/2.2.x/
+ http://fisheye.jboss.org/browse/exo-jcr/kernel/branches/2.2.x=
url>
=
--===============2341798383672823737==--
From do-not-reply at jboss.org Fri Oct 8 15:50:26 2010
Content-Type: multipart/mixed; boundary="===============6879309683414565188=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3270 - core/branches/2.3.x.
Date: Fri, 08 Oct 2010 15:50:26 -0400
Message-ID: <201010081950.o98JoQCr030473@svn01.web.mwc.hst.phx2.redhat.com>
--===============6879309683414565188==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: aheritier
Date: 2010-10-08 15:50:26 -0400 (Fri, 08 Oct 2010)
New Revision: 3270
Modified:
core/branches/2.3.x/pom.xml
Log:
[maven-release-plugin] prepare branch 2.3.5-GA_REL
Modified: core/branches/2.3.x/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/2.3.x/pom.xml 2010-10-08 19:43:00 UTC (rev 3269)
+++ core/branches/2.3.x/pom.xml 2010-10-08 19:50:26 UTC (rev 3270)
@@ -43,9 +43,9 @@
=
- scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/core/bran=
ches/2.3.x/
- scm:svn:https://svn.jboss.org/repos/exo-jcr/cor=
e/branches/2.3.x/
- http://fisheye.jboss.org/browse/exo-jcr/core/branches/2.3.x
+ scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/core/bran=
ches/2.3.5-GA_REL
+ scm:svn:https://svn.jboss.org/repos/exo-jcr/cor=
e/branches/2.3.5-GA_REL
+ http://fisheye.jboss.org/browse/exo-jcr/core/branches/2.3.5-GA_=
REL
=
--===============6879309683414565188==--
From do-not-reply at jboss.org Fri Oct 8 15:50:50 2010
Content-Type: multipart/mixed; boundary="===============6156463827825876689=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3271 - core/branches.
Date: Fri, 08 Oct 2010 15:50:49 -0400
Message-ID: <201010081950.o98JonaK030507@svn01.web.mwc.hst.phx2.redhat.com>
--===============6156463827825876689==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: aheritier
Date: 2010-10-08 15:50:49 -0400 (Fri, 08 Oct 2010)
New Revision: 3271
Added:
core/branches/2.3.5-GA_REL/
Log:
[maven-release-plugin] copy for branch 2.3.5-GA_REL
Copied: core/branches/2.3.5-GA_REL (from rev 3270, core/branches/2.3.x)
--===============6156463827825876689==--
From do-not-reply at jboss.org Fri Oct 8 15:51:17 2010
Content-Type: multipart/mixed; boundary="===============5477992474785377677=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3272 - in core/branches/2.3.x:
exo.core.component.database and 10 other directories.
Date: Fri, 08 Oct 2010 15:51:17 -0400
Message-ID: <201010081951.o98JpHZm030551@svn01.web.mwc.hst.phx2.redhat.com>
--===============5477992474785377677==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: aheritier
Date: 2010-10-08 15:51:17 -0400 (Fri, 08 Oct 2010)
New Revision: 3272
Modified:
core/branches/2.3.x/exo.core.component.database/pom.xml
core/branches/2.3.x/exo.core.component.document/pom.xml
core/branches/2.3.x/exo.core.component.ldap/pom.xml
core/branches/2.3.x/exo.core.component.organization.api/pom.xml
core/branches/2.3.x/exo.core.component.organization.jdbc/pom.xml
core/branches/2.3.x/exo.core.component.organization.ldap/pom.xml
core/branches/2.3.x/exo.core.component.script.groovy/pom.xml
core/branches/2.3.x/exo.core.component.security.core/pom.xml
core/branches/2.3.x/exo.core.component.web.css/pom.xml
core/branches/2.3.x/exo.core.component.xml-processing/pom.xml
core/branches/2.3.x/packaging/module/pom.xml
core/branches/2.3.x/pom.xml
Log:
[maven-release-plugin] prepare release 2.3.5-GA_REL
Modified: core/branches/2.3.x/exo.core.component.database/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/2.3.x/exo.core.component.database/pom.xml 2010-10-08 19:5=
0:49 UTC (rev 3271)
+++ core/branches/2.3.x/exo.core.component.database/pom.xml 2010-10-08 19:5=
1:17 UTC (rev 3272)
@@ -25,7 +25,7 @@
org.exoplatform.core
core-parent
- 2.3.5-GA-SNAPSHOT
+ 2.3.6-GA-SNAPSHOT
=
exo.core.component.database
Modified: core/branches/2.3.x/exo.core.component.document/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/2.3.x/exo.core.component.document/pom.xml 2010-10-08 19:5=
0:49 UTC (rev 3271)
+++ core/branches/2.3.x/exo.core.component.document/pom.xml 2010-10-08 19:5=
1:17 UTC (rev 3272)
@@ -14,7 +14,7 @@
org.exoplatform.core
core-parent
- 2.3.5-GA-SNAPSHOT
+ 2.3.6-GA-SNAPSHOT
exo.core.component.document
eXo Core :: Component :: Demo Service
Modified: core/branches/2.3.x/exo.core.component.ldap/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/2.3.x/exo.core.component.ldap/pom.xml 2010-10-08 19:50:49=
UTC (rev 3271)
+++ core/branches/2.3.x/exo.core.component.ldap/pom.xml 2010-10-08 19:51:17=
UTC (rev 3272)
@@ -25,7 +25,7 @@
org.exoplatform.core
core-parent
- 2.3.5-GA-SNAPSHOT
+ 2.3.6-GA-SNAPSHOT
=
exo.core.component.ldap
Modified: core/branches/2.3.x/exo.core.component.organization.api/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/2.3.x/exo.core.component.organization.api/pom.xml 2010-10=
-08 19:50:49 UTC (rev 3271)
+++ core/branches/2.3.x/exo.core.component.organization.api/pom.xml 2010-10=
-08 19:51:17 UTC (rev 3272)
@@ -23,7 +23,7 @@
org.exoplatform.core
core-parent
- 2.3.5-GA-SNAPSHOT
+ 2.3.6-GA-SNAPSHOT
exo.core.component.organization.api
eXo Core :: Component :: Organization Service API
Modified: core/branches/2.3.x/exo.core.component.organization.jdbc/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/2.3.x/exo.core.component.organization.jdbc/pom.xml 2010-1=
0-08 19:50:49 UTC (rev 3271)
+++ core/branches/2.3.x/exo.core.component.organization.jdbc/pom.xml 2010-1=
0-08 19:51:17 UTC (rev 3272)
@@ -25,7 +25,7 @@
org.exoplatform.core
core-parent
- 2.3.5-GA-SNAPSHOT
+ 2.3.6-GA-SNAPSHOT
=
exo.core.component.organization.jdbc
Modified: core/branches/2.3.x/exo.core.component.organization.ldap/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/2.3.x/exo.core.component.organization.ldap/pom.xml 2010-1=
0-08 19:50:49 UTC (rev 3271)
+++ core/branches/2.3.x/exo.core.component.organization.ldap/pom.xml 2010-1=
0-08 19:51:17 UTC (rev 3272)
@@ -25,7 +25,7 @@
org.exoplatform.core
core-parent
- 2.3.5-GA-SNAPSHOT
+ 2.3.6-GA-SNAPSHOT
=
exo.core.component.organization.ldap
Modified: core/branches/2.3.x/exo.core.component.script.groovy/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/2.3.x/exo.core.component.script.groovy/pom.xml 2010-10-08=
19:50:49 UTC (rev 3271)
+++ core/branches/2.3.x/exo.core.component.script.groovy/pom.xml 2010-10-08=
19:51:17 UTC (rev 3272)
@@ -25,7 +25,7 @@
org.exoplatform.core
core-parent
- 2.3.5-GA-SNAPSHOT
+ 2.3.6-GA-SNAPSHOT
=
exo.core.component.script.groovy
Modified: core/branches/2.3.x/exo.core.component.security.core/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/2.3.x/exo.core.component.security.core/pom.xml 2010-10-08=
19:50:49 UTC (rev 3271)
+++ core/branches/2.3.x/exo.core.component.security.core/pom.xml 2010-10-08=
19:51:17 UTC (rev 3272)
@@ -25,7 +25,7 @@
org.exoplatform.core
core-parent
- 2.3.5-GA-SNAPSHOT
+ 2.3.6-GA-SNAPSHOT
=
exo.core.component.security.core
Modified: core/branches/2.3.x/exo.core.component.web.css/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/2.3.x/exo.core.component.web.css/pom.xml 2010-10-08 19:50=
:49 UTC (rev 3271)
+++ core/branches/2.3.x/exo.core.component.web.css/pom.xml 2010-10-08 19:51=
:17 UTC (rev 3272)
@@ -25,7 +25,7 @@
org.exoplatform.core
core-parent
- 2.3.5-GA-SNAPSHOT
+ 2.3.6-GA-SNAPSHOT
=
exo.core.component.web.css
Modified: core/branches/2.3.x/exo.core.component.xml-processing/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/2.3.x/exo.core.component.xml-processing/pom.xml 2010-10-0=
8 19:50:49 UTC (rev 3271)
+++ core/branches/2.3.x/exo.core.component.xml-processing/pom.xml 2010-10-0=
8 19:51:17 UTC (rev 3272)
@@ -23,7 +23,7 @@
org.exoplatform.core
core-parent
- 2.3.5-GA-SNAPSHOT
+ 2.3.6-GA-SNAPSHOT
exo.core.component.xml-processing
eXo Core :: Component :: XML Processing Service
Modified: core/branches/2.3.x/packaging/module/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/2.3.x/packaging/module/pom.xml 2010-10-08 19:50:49 UTC (r=
ev 3271)
+++ core/branches/2.3.x/packaging/module/pom.xml 2010-10-08 19:51:17 UTC (r=
ev 3272)
@@ -2,7 +2,7 @@
org.exoplatform.core
core-parent
- 2.3.5-GA-SNAPSHOT
+ 2.3.6-GA-SNAPSHOT
=
4.0.0
@@ -18,13 +18,13 @@
=
- org.exoplatform.core exo=
.core.component.database 2.3.5-GA-SNAPSHOT =
dependency>
- org.exoplatform.core exo=
.core.component.document 2.3.5-GA-SNAPSHOT =
dependency>
- org.exoplatform.core exo=
.core.component.organization.api 2.3.5-GA-SNAPSHOT
- org.exoplatform.core exo=
.core.component.organization.ldap 2.3.5-GA-SNAPSHOT
- org.exoplatform.core exo=
.core.component.security.core 2.3.5-GA-SNAPSHOT
- org.exoplatform.core exo=
.core.component.xml-processing 2.3.5-GA-SNAPSHOT
- org.exoplatform.core exo=
.core.component.script.groovy 2.3.5-GA-SNAPSHOT
+ org.exoplatform.core exo=
.core.component.database 2.3.6-GA-SNAPSHOT =
dependency>
+ org.exoplatform.core exo=
.core.component.document 2.3.6-GA-SNAPSHOT =
dependency>
+ org.exoplatform.core exo=
.core.component.organization.api 2.3.6-GA-SNAPSHOT
+ org.exoplatform.core exo=
.core.component.organization.ldap 2.3.6-GA-SNAPSHOT
+ org.exoplatform.core exo=
.core.component.security.core 2.3.6-GA-SNAPSHOT
+ org.exoplatform.core exo=
.core.component.xml-processing 2.3.6-GA-SNAPSHOT
+ org.exoplatform.core exo=
.core.component.script.groovy 2.3.6-GA-SNAPSHOT
=
Modified: core/branches/2.3.x/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/2.3.x/pom.xml 2010-10-08 19:50:49 UTC (rev 3271)
+++ core/branches/2.3.x/pom.xml 2010-10-08 19:51:17 UTC (rev 3272)
@@ -29,7 +29,7 @@
=
org.exoplatform.core
core-parent
- 2.3.5-GA-SNAPSHOT
+ 2.3.6-GA-SNAPSHOT
pom
=
eXo Core
@@ -43,9 +43,9 @@
=
- scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/core/bran=
ches/2.3.5-GA_REL
- scm:svn:https://svn.jboss.org/repos/exo-jcr/cor=
e/branches/2.3.5-GA_REL
- http://fisheye.jboss.org/browse/exo-jcr/core/branches/2.3.5-GA_=
REL
+ scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/core/bran=
ches/2.3.x/
+ scm:svn:https://svn.jboss.org/repos/exo-jcr/cor=
e/branches/2.3.x/
+ http://fisheye.jboss.org/browse/exo-jcr/core/branches/2.3.x
=
--===============5477992474785377677==--
From do-not-reply at jboss.org Fri Oct 8 15:55:59 2010
Content-Type: multipart/mixed; boundary="===============2840475882688687923=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3273 - in core/branches/2.3.x:
exo.core.component.organization.api and 5 other directories.
Date: Fri, 08 Oct 2010 15:55:59 -0400
Message-ID: <201010081955.o98Jtx08030656@svn01.web.mwc.hst.phx2.redhat.com>
--===============2840475882688687923==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: aheritier
Date: 2010-10-08 15:55:58 -0400 (Fri, 08 Oct 2010)
New Revision: 3273
Modified:
core/branches/2.3.x/exo.core.component.organization.api/pom.xml
core/branches/2.3.x/exo.core.component.organization.jdbc/pom.xml
core/branches/2.3.x/exo.core.component.organization.ldap/pom.xml
core/branches/2.3.x/exo.core.component.script.groovy/pom.xml
core/branches/2.3.x/exo.core.component.security.core/pom.xml
core/branches/2.3.x/exo.core.component.xml-processing/pom.xml
core/branches/2.3.x/pom.xml
Log:
[EXOJCR-XXX] -mUpgrade to next SNAPSHOTs
Modified: core/branches/2.3.x/exo.core.component.organization.api/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/2.3.x/exo.core.component.organization.api/pom.xml 2010-10=
-08 19:51:17 UTC (rev 3272)
+++ core/branches/2.3.x/exo.core.component.organization.api/pom.xml 2010-10=
-08 19:55:58 UTC (rev 3273)
@@ -118,4 +118,4 @@
-
\ No newline at end of file
+
Modified: core/branches/2.3.x/exo.core.component.organization.jdbc/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/2.3.x/exo.core.component.organization.jdbc/pom.xml 2010-1=
0-08 19:51:17 UTC (rev 3272)
+++ core/branches/2.3.x/exo.core.component.organization.jdbc/pom.xml 2010-1=
0-08 19:55:58 UTC (rev 3273)
@@ -117,4 +117,4 @@
=
=
-
\ No newline at end of file
+
Modified: core/branches/2.3.x/exo.core.component.organization.ldap/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/2.3.x/exo.core.component.organization.ldap/pom.xml 2010-1=
0-08 19:51:17 UTC (rev 3272)
+++ core/branches/2.3.x/exo.core.component.organization.ldap/pom.xml 2010-1=
0-08 19:55:58 UTC (rev 3273)
@@ -80,4 +80,4 @@
=
-
\ No newline at end of file
+
Modified: core/branches/2.3.x/exo.core.component.script.groovy/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/2.3.x/exo.core.component.script.groovy/pom.xml 2010-10-08=
19:51:17 UTC (rev 3272)
+++ core/branches/2.3.x/exo.core.component.script.groovy/pom.xml 2010-10-08=
19:55:58 UTC (rev 3273)
@@ -47,4 +47,4 @@
groovy-all
-
\ No newline at end of file
+
Modified: core/branches/2.3.x/exo.core.component.security.core/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/2.3.x/exo.core.component.security.core/pom.xml 2010-10-08=
19:51:17 UTC (rev 3272)
+++ core/branches/2.3.x/exo.core.component.security.core/pom.xml 2010-10-08=
19:55:58 UTC (rev 3273)
@@ -79,4 +79,4 @@
-
\ No newline at end of file
+
Modified: core/branches/2.3.x/exo.core.component.xml-processing/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/2.3.x/exo.core.component.xml-processing/pom.xml 2010-10-0=
8 19:51:17 UTC (rev 3272)
+++ core/branches/2.3.x/exo.core.component.xml-processing/pom.xml 2010-10-0=
8 19:55:58 UTC (rev 3273)
@@ -98,4 +98,4 @@
-
\ No newline at end of file
+
Modified: core/branches/2.3.x/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/2.3.x/pom.xml 2010-10-08 19:51:17 UTC (rev 3272)
+++ core/branches/2.3.x/pom.xml 2010-10-08 19:55:58 UTC (rev 3273)
@@ -39,7 +39,7 @@
2.3
=
1.2.1-GA
- 2.2.5-GA-SNAPSHOT
+ 2.2.6-GA-SNAPSHOT
=
--===============2840475882688687923==--
From do-not-reply at jboss.org Fri Oct 8 16:03:09 2010
Content-Type: multipart/mixed; boundary="===============5874194539584196142=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3274 - ws/branches/2.1.x.
Date: Fri, 08 Oct 2010 16:03:09 -0400
Message-ID: <201010082003.o98K39Nx032113@svn01.web.mwc.hst.phx2.redhat.com>
--===============5874194539584196142==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: aheritier
Date: 2010-10-08 16:03:08 -0400 (Fri, 08 Oct 2010)
New Revision: 3274
Modified:
ws/branches/2.1.x/pom.xml
Log:
[maven-release-plugin] prepare branch 2.1.5-GA_REL
Modified: ws/branches/2.1.x/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/branches/2.1.x/pom.xml 2010-10-08 19:55:58 UTC (rev 3273)
+++ ws/branches/2.1.x/pom.xml 2010-10-08 20:03:08 UTC (rev 3274)
@@ -35,9 +35,9 @@
eXo WS
=
- scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/ws/branch=
es/2.1.x/
- scm:svn:https://svn.jboss.org/repos/exo-jcr/ws/=
branches/2.1.x/
- http://fisheye.jboss.org/browse/exo-jcr/ws/branches/2.1.x
+ scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/ws/branch=
es/2.1.5-GA_REL
+ scm:svn:https://svn.jboss.org/repos/exo-jcr/ws/=
branches/2.1.5-GA_REL
+ http://fisheye.jboss.org/browse/exo-jcr/ws/branches/2.1.5-GA_RE=
L
=
--===============5874194539584196142==--
From do-not-reply at jboss.org Fri Oct 8 16:03:32 2010
Content-Type: multipart/mixed; boundary="===============2973809623795513574=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3275 - ws/branches.
Date: Fri, 08 Oct 2010 16:03:31 -0400
Message-ID: <201010082003.o98K3V45005028@svn01.web.mwc.hst.phx2.redhat.com>
--===============2973809623795513574==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: aheritier
Date: 2010-10-08 16:03:31 -0400 (Fri, 08 Oct 2010)
New Revision: 3275
Added:
ws/branches/2.1.5-GA_REL/
Log:
[maven-release-plugin] copy for branch 2.1.5-GA_REL
Copied: ws/branches/2.1.5-GA_REL (from rev 3274, ws/branches/2.1.x)
--===============2973809623795513574==--
From do-not-reply at jboss.org Fri Oct 8 16:03:52 2010
Content-Type: multipart/mixed; boundary="===============8602905243578192571=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3276 - in ws/branches/2.1.x:
exo.ws.commons and 6 other directories.
Date: Fri, 08 Oct 2010 16:03:51 -0400
Message-ID: <201010082003.o98K3pJD005042@svn01.web.mwc.hst.phx2.redhat.com>
--===============8602905243578192571==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: aheritier
Date: 2010-10-08 16:03:51 -0400 (Fri, 08 Oct 2010)
New Revision: 3276
Modified:
ws/branches/2.1.x/exo.ws.commons/pom.xml
ws/branches/2.1.x/exo.ws.frameworks.json/pom.xml
ws/branches/2.1.x/exo.ws.frameworks.servlet/pom.xml
ws/branches/2.1.x/exo.ws.rest.core/pom.xml
ws/branches/2.1.x/exo.ws.rest.ext/pom.xml
ws/branches/2.1.x/exo.ws.testframework/pom.xml
ws/branches/2.1.x/packaging/module/pom.xml
ws/branches/2.1.x/pom.xml
Log:
[maven-release-plugin] prepare release 2.1.5-GA_REL
Modified: ws/branches/2.1.x/exo.ws.commons/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/branches/2.1.x/exo.ws.commons/pom.xml 2010-10-08 20:03:31 UTC (rev 3=
275)
+++ ws/branches/2.1.x/exo.ws.commons/pom.xml 2010-10-08 20:03:51 UTC (rev 3=
276)
@@ -25,7 +25,7 @@
org.exoplatform.ws
ws-parent
- 2.1.5-GA-SNAPSHOT
+ 2.1.6-GA-SNAPSHOT
=
exo.ws.commons
Modified: ws/branches/2.1.x/exo.ws.frameworks.json/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/branches/2.1.x/exo.ws.frameworks.json/pom.xml 2010-10-08 20:03:31 UT=
C (rev 3275)
+++ ws/branches/2.1.x/exo.ws.frameworks.json/pom.xml 2010-10-08 20:03:51 UT=
C (rev 3276)
@@ -25,7 +25,7 @@
org.exoplatform.ws
ws-parent
- 2.1.5-GA-SNAPSHOT
+ 2.1.6-GA-SNAPSHOT
=
exo.ws.frameworks.json
Modified: ws/branches/2.1.x/exo.ws.frameworks.servlet/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/branches/2.1.x/exo.ws.frameworks.servlet/pom.xml 2010-10-08 20:03:31=
UTC (rev 3275)
+++ ws/branches/2.1.x/exo.ws.frameworks.servlet/pom.xml 2010-10-08 20:03:51=
UTC (rev 3276)
@@ -25,7 +25,7 @@
org.exoplatform.ws
ws-parent
- 2.1.5-GA-SNAPSHOT
+ 2.1.6-GA-SNAPSHOT
=
exo.ws.frameworks.servlet
Modified: ws/branches/2.1.x/exo.ws.rest.core/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/branches/2.1.x/exo.ws.rest.core/pom.xml 2010-10-08 20:03:31 UTC (rev=
3275)
+++ ws/branches/2.1.x/exo.ws.rest.core/pom.xml 2010-10-08 20:03:51 UTC (rev=
3276)
@@ -25,7 +25,7 @@
org.exoplatform.ws
ws-parent
- 2.1.5-GA-SNAPSHOT
+ 2.1.6-GA-SNAPSHOT
=
exo.ws.rest.core
Modified: ws/branches/2.1.x/exo.ws.rest.ext/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/branches/2.1.x/exo.ws.rest.ext/pom.xml 2010-10-08 20:03:31 UTC (rev =
3275)
+++ ws/branches/2.1.x/exo.ws.rest.ext/pom.xml 2010-10-08 20:03:51 UTC (rev =
3276)
@@ -25,7 +25,7 @@
org.exoplatform.ws
ws-parent
- 2.1.5-GA-SNAPSHOT
+ 2.1.6-GA-SNAPSHOT
=
exo.ws.rest.ext
Modified: ws/branches/2.1.x/exo.ws.testframework/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/branches/2.1.x/exo.ws.testframework/pom.xml 2010-10-08 20:03:31 UTC =
(rev 3275)
+++ ws/branches/2.1.x/exo.ws.testframework/pom.xml 2010-10-08 20:03:51 UTC =
(rev 3276)
@@ -25,7 +25,7 @@
org.exoplatform.ws
ws-parent
- 2.1.5-GA-SNAPSHOT
+ 2.1.6-GA-SNAPSHOT
=
exo.ws.testframework
Modified: ws/branches/2.1.x/packaging/module/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/branches/2.1.x/packaging/module/pom.xml 2010-10-08 20:03:31 UTC (rev=
3275)
+++ ws/branches/2.1.x/packaging/module/pom.xml 2010-10-08 20:03:51 UTC (rev=
3276)
@@ -2,7 +2,7 @@
org.exoplatform.ws
ws-parent
- 2.1.5-GA-SNAPSHOT
+ 2.1.6-GA-SNAPSHOT
=
4.0.0
Modified: ws/branches/2.1.x/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/branches/2.1.x/pom.xml 2010-10-08 20:03:31 UTC (rev 3275)
+++ ws/branches/2.1.x/pom.xml 2010-10-08 20:03:51 UTC (rev 3276)
@@ -30,14 +30,14 @@
=
org.exoplatform.ws
ws-parent
- 2.1.5-GA-SNAPSHOT
+ 2.1.6-GA-SNAPSHOT
pom
eXo WS
=
- scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/ws/branch=
es/2.1.5-GA_REL
- scm:svn:https://svn.jboss.org/repos/exo-jcr/ws/=
branches/2.1.5-GA_REL
- http://fisheye.jboss.org/browse/exo-jcr/ws/branches/2.1.5-GA_RE=
L
+ scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/ws/branch=
es/2.1.x/
+ scm:svn:https://svn.jboss.org/repos/exo-jcr/ws/=
branches/2.1.x/
+ http://fisheye.jboss.org/browse/exo-jcr/ws/branches/2.1.x
=
--===============8602905243578192571==--
From do-not-reply at jboss.org Fri Oct 8 16:04:08 2010
Content-Type: multipart/mixed; boundary="===============6638900977141697578=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3277 - in ws/branches/2.1.x:
exo.ws.testframework and 1 other directory.
Date: Fri, 08 Oct 2010 16:04:08 -0400
Message-ID: <201010082004.o98K48X4005052@svn01.web.mwc.hst.phx2.redhat.com>
--===============6638900977141697578==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: aheritier
Date: 2010-10-08 16:04:07 -0400 (Fri, 08 Oct 2010)
New Revision: 3277
Modified:
ws/branches/2.1.x/exo.ws.testframework/pom.xml
ws/branches/2.1.x/pom.xml
Log:
[EXOJCR-XXX] -mUpgrade to next SNAPSHOTs
Modified: ws/branches/2.1.x/exo.ws.testframework/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/branches/2.1.x/exo.ws.testframework/pom.xml 2010-10-08 20:03:51 UTC =
(rev 3276)
+++ ws/branches/2.1.x/exo.ws.testframework/pom.xml 2010-10-08 20:04:07 UTC =
(rev 3277)
@@ -38,4 +38,4 @@
servlet-api
-
\ No newline at end of file
+
Modified: ws/branches/2.1.x/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ws/branches/2.1.x/pom.xml 2010-10-08 20:03:51 UTC (rev 3276)
+++ ws/branches/2.1.x/pom.xml 2010-10-08 20:04:07 UTC (rev 3277)
@@ -44,8 +44,8 @@
exo-ws
2.1
=
- 2.2.5-GA-SNAPSHOT
- 2.3.5-GA-SNAPSHOT
+ 2.2.6-GA-SNAPSHOT
+ 2.3.6-GA-SNAPSHOT
=
--===============6638900977141697578==--
From do-not-reply at jboss.org Fri Oct 8 16:04:50 2010
Content-Type: multipart/mixed; boundary="===============5176665511446883108=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3278 - in jcr/branches/1.12.x:
applications/exo.jcr.applications.tomcat and 1 other directory.
Date: Fri, 08 Oct 2010 16:04:49 -0400
Message-ID: <201010082004.o98K4n9j005064@svn01.web.mwc.hst.phx2.redhat.com>
--===============5176665511446883108==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: aheritier
Date: 2010-10-08 16:04:49 -0400 (Fri, 08 Oct 2010)
New Revision: 3278
Modified:
jcr/branches/1.12.x/applications/exo.jcr.applications.tomcat/pom.xml
jcr/branches/1.12.x/pom.xml
Log:
[maven-release-plugin] prepare branch 1.12.5-GA_REL
Modified: jcr/branches/1.12.x/applications/exo.jcr.applications.tomcat/pom.=
xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/applications/exo.jcr.applications.tomcat/pom.xml 20=
10-10-08 20:04:07 UTC (rev 3277)
+++ jcr/branches/1.12.x/applications/exo.jcr.applications.tomcat/pom.xml 20=
10-10-08 20:04:49 UTC (rev 3278)
@@ -101,14 +101,14 @@
-
+
-
+
-
+
Modified: jcr/branches/1.12.x/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/pom.xml 2010-10-08 20:04:07 UTC (rev 3277)
+++ jcr/branches/1.12.x/pom.xml 2010-10-08 20:04:49 UTC (rev 3278)
@@ -34,9 +34,9 @@
eXo JCR
=
- scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/jcr/branche=
s/1.12.x/
- scm:svn:https://svn.jboss.org/repos/exo-jcr/jcr/b=
ranches/1.12.x/
- http://fisheye.jboss.org/browse/exo-jcr/jcr/branches/1.12.x
+ scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/jcr/branche=
s/1.12.5-GA_REL
+ scm:svn:https://svn.jboss.org/repos/exo-jcr/jcr/b=
ranches/1.12.5-GA_REL
+ http://fisheye.jboss.org/browse/exo-jcr/jcr/branches/1.12.5-GA_RE=
L
=
--===============5176665511446883108==--
From do-not-reply at jboss.org Fri Oct 8 16:05:18 2010
Content-Type: multipart/mixed; boundary="===============2483555317606327097=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3279 - jcr/branches.
Date: Fri, 08 Oct 2010 16:05:17 -0400
Message-ID: <201010082005.o98K5HU9005113@svn01.web.mwc.hst.phx2.redhat.com>
--===============2483555317606327097==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: aheritier
Date: 2010-10-08 16:05:13 -0400 (Fri, 08 Oct 2010)
New Revision: 3279
Added:
jcr/branches/1.12.5-GA_REL/
Log:
[maven-release-plugin] copy for branch 1.12.5-GA_REL
Copied: jcr/branches/1.12.5-GA_REL (from rev 3278, jcr/branches/1.12.x)
--===============2483555317606327097==--
From do-not-reply at jboss.org Fri Oct 8 16:06:09 2010
Content-Type: multipart/mixed; boundary="===============8445395669535017625=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3280 - in jcr/branches/1.12.x:
applications and 23 other directories.
Date: Fri, 08 Oct 2010 16:06:09 -0400
Message-ID: <201010082006.o98K69pf005187@svn01.web.mwc.hst.phx2.redhat.com>
--===============8445395669535017625==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: aheritier
Date: 2010-10-08 16:06:07 -0400 (Fri, 08 Oct 2010)
New Revision: 3280
Modified:
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/pom.=
xml
jcr/branches/1.12.x/applications/exo.jcr.applications.browser/pom.xml
jcr/branches/1.12.x/applications/exo.jcr.applications.config/pom.xml
jcr/branches/1.12.x/applications/exo.jcr.applications.fckeditor/pom.xml
jcr/branches/1.12.x/applications/exo.jcr.applications.jboss/pom.xml
jcr/branches/1.12.x/applications/exo.jcr.applications.jonas/pom.xml
jcr/branches/1.12.x/applications/exo.jcr.applications.rest/pom.xml
jcr/branches/1.12.x/applications/exo.jcr.applications.tomcat/pom.xml
jcr/branches/1.12.x/applications/exo.jcr.cluster.testclient/pom.xml
jcr/branches/1.12.x/applications/exo.jcr.ear/pom.xml
jcr/branches/1.12.x/applications/pom.xml
jcr/branches/1.12.x/exo.jcr.component.core/pom.xml
jcr/branches/1.12.x/exo.jcr.component.ext/pom.xml
jcr/branches/1.12.x/exo.jcr.component.ftp/pom.xml
jcr/branches/1.12.x/exo.jcr.component.statistics/pom.xml
jcr/branches/1.12.x/exo.jcr.component.webdav/pom.xml
jcr/branches/1.12.x/exo.jcr.connectors.localadapter/pom.xml
jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/pom.xml
jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/pom.xml
jcr/branches/1.12.x/exo.jcr.docs/pom.xml
jcr/branches/1.12.x/exo.jcr.framework.command/pom.xml
jcr/branches/1.12.x/exo.jcr.framework.ftpclient/pom.xml
jcr/branches/1.12.x/exo.jcr.framework.web/pom.xml
jcr/branches/1.12.x/packaging/module/pom.xml
jcr/branches/1.12.x/pom.xml
Log:
[maven-release-plugin] prepare release 1.12.5-GA_REL
Modified: jcr/branches/1.12.x/applications/exo.jcr.applications.backupconso=
le/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/pom=
.xml 2010-10-08 20:05:13 UTC (rev 3279)
+++ jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/pom=
.xml 2010-10-08 20:06:07 UTC (rev 3280)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-applications-parent
- 1.12.5-GA-SNAPSHOT
+ 1.12.6-GA-SNAPSHOT
exo.jcr.applications.backupconsole
eXo JCR :: Applications :: Backup Console
Modified: jcr/branches/1.12.x/applications/exo.jcr.applications.browser/pom=
.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/applications/exo.jcr.applications.browser/pom.xml 2=
010-10-08 20:05:13 UTC (rev 3279)
+++ jcr/branches/1.12.x/applications/exo.jcr.applications.browser/pom.xml 2=
010-10-08 20:06:07 UTC (rev 3280)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-applications-parent
- 1.12.5-GA-SNAPSHOT
+ 1.12.6-GA-SNAPSHOT
exo.jcr.applications.browser
war
Modified: jcr/branches/1.12.x/applications/exo.jcr.applications.config/pom.=
xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/applications/exo.jcr.applications.config/pom.xml 20=
10-10-08 20:05:13 UTC (rev 3279)
+++ jcr/branches/1.12.x/applications/exo.jcr.applications.config/pom.xml 20=
10-10-08 20:06:07 UTC (rev 3280)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-applications-parent
- 1.12.5-GA-SNAPSHOT
+ 1.12.6-GA-SNAPSHOT
exo.jcr.applications.config
pom
Modified: jcr/branches/1.12.x/applications/exo.jcr.applications.fckeditor/p=
om.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/applications/exo.jcr.applications.fckeditor/pom.xml=
2010-10-08 20:05:13 UTC (rev 3279)
+++ jcr/branches/1.12.x/applications/exo.jcr.applications.fckeditor/pom.xml=
2010-10-08 20:06:07 UTC (rev 3280)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-applications-parent
- 1.12.5-GA-SNAPSHOT
+ 1.12.6-GA-SNAPSHOT
exo.jcr.applications.fckeditor
war
Modified: jcr/branches/1.12.x/applications/exo.jcr.applications.jboss/pom.x=
ml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/applications/exo.jcr.applications.jboss/pom.xml 201=
0-10-08 20:05:13 UTC (rev 3279)
+++ jcr/branches/1.12.x/applications/exo.jcr.applications.jboss/pom.xml 201=
0-10-08 20:06:07 UTC (rev 3280)
@@ -22,7 +22,7 @@
org.exoplatform.jcr
exo.jcr.applications.config
- 1.12.5-GA-SNAPSHOT
+ 1.12.6-GA-SNAPSHOT
=
4.0.0
@@ -40,7 +40,7 @@
org.exoplatform.jcr
exo.jcr.ear
- 1.12.5-GA-SNAPSHOT
+ 1.12.6-GA-SNAPSHOT
ear
runtime
Modified: jcr/branches/1.12.x/applications/exo.jcr.applications.jonas/pom.x=
ml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/applications/exo.jcr.applications.jonas/pom.xml 201=
0-10-08 20:05:13 UTC (rev 3279)
+++ jcr/branches/1.12.x/applications/exo.jcr.applications.jonas/pom.xml 201=
0-10-08 20:06:07 UTC (rev 3280)
@@ -22,7 +22,7 @@
org.exoplatform.jcr
exo.jcr.applications.config
- 1.12.5-GA-SNAPSHOT
+ 1.12.6-GA-SNAPSHOT
=
4.0.0
@@ -40,7 +40,7 @@
org.exoplatform.jcr
exo.jcr.ear
- 1.12.5-GA-SNAPSHOT
+ 1.12.6-GA-SNAPSHOT
ear
runtime
Modified: jcr/branches/1.12.x/applications/exo.jcr.applications.rest/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/applications/exo.jcr.applications.rest/pom.xml 2010=
-10-08 20:05:13 UTC (rev 3279)
+++ jcr/branches/1.12.x/applications/exo.jcr.applications.rest/pom.xml 2010=
-10-08 20:06:07 UTC (rev 3280)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-applications-parent
- 1.12.5-GA-SNAPSHOT
+ 1.12.6-GA-SNAPSHOT
exo.jcr.applications.rest
war
Modified: jcr/branches/1.12.x/applications/exo.jcr.applications.tomcat/pom.=
xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/applications/exo.jcr.applications.tomcat/pom.xml 20=
10-10-08 20:05:13 UTC (rev 3279)
+++ jcr/branches/1.12.x/applications/exo.jcr.applications.tomcat/pom.xml 20=
10-10-08 20:06:07 UTC (rev 3280)
@@ -22,7 +22,7 @@
org.exoplatform.jcr
exo.jcr.applications.config
- 1.12.5-GA-SNAPSHOT
+ 1.12.6-GA-SNAPSHOT
exo.jcr.applications.config
=
Modified: jcr/branches/1.12.x/applications/exo.jcr.cluster.testclient/pom.x=
ml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/applications/exo.jcr.cluster.testclient/pom.xml 201=
0-10-08 20:05:13 UTC (rev 3279)
+++ jcr/branches/1.12.x/applications/exo.jcr.cluster.testclient/pom.xml 201=
0-10-08 20:06:07 UTC (rev 3280)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-applications-parent
- 1.12.5-GA-SNAPSHOT
+ 1.12.6-GA-SNAPSHOT
exo.jcr.cluster.testclient
eXo JCR :: Cluster :: Test Client
Modified: jcr/branches/1.12.x/applications/exo.jcr.ear/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/applications/exo.jcr.ear/pom.xml 2010-10-08 20:05:1=
3 UTC (rev 3279)
+++ jcr/branches/1.12.x/applications/exo.jcr.ear/pom.xml 2010-10-08 20:06:0=
7 UTC (rev 3280)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-applications-parent
- 1.12.5-GA-SNAPSHOT
+ 1.12.6-GA-SNAPSHOT
exo.jcr.ear
ear
Modified: jcr/branches/1.12.x/applications/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/applications/pom.xml 2010-10-08 20:05:13 UTC (rev 3=
279)
+++ jcr/branches/1.12.x/applications/pom.xml 2010-10-08 20:06:07 UTC (rev 3=
280)
@@ -22,12 +22,12 @@
org.exoplatform.jcr
jcr-parent
- 1.12.5-GA-SNAPSHOT
+ 1.12.6-GA-SNAPSHOT
=
4.0.0
jcr-applications-parent
- 1.12.5-GA-SNAPSHOT
+ 1.12.6-GA-SNAPSHOT
=
eXo JCR :: Applications :: Reactor
pom
Modified: jcr/branches/1.12.x/exo.jcr.component.core/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.component.core/pom.xml 2010-10-08 20:05:13 =
UTC (rev 3279)
+++ jcr/branches/1.12.x/exo.jcr.component.core/pom.xml 2010-10-08 20:06:07 =
UTC (rev 3280)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-parent
- 1.12.5-GA-SNAPSHOT
+ 1.12.6-GA-SNAPSHOT
exo.jcr.component.core
eXo JCR :: Component :: Core Service
Modified: jcr/branches/1.12.x/exo.jcr.component.ext/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.component.ext/pom.xml 2010-10-08 20:05:13 U=
TC (rev 3279)
+++ jcr/branches/1.12.x/exo.jcr.component.ext/pom.xml 2010-10-08 20:06:07 U=
TC (rev 3280)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-parent
- 1.12.5-GA-SNAPSHOT
+ 1.12.6-GA-SNAPSHOT
exo.jcr.component.ext
eXo JCR :: Component :: Extension Service
Modified: jcr/branches/1.12.x/exo.jcr.component.ftp/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.component.ftp/pom.xml 2010-10-08 20:05:13 U=
TC (rev 3279)
+++ jcr/branches/1.12.x/exo.jcr.component.ftp/pom.xml 2010-10-08 20:06:07 U=
TC (rev 3280)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-parent
- 1.12.5-GA-SNAPSHOT
+ 1.12.6-GA-SNAPSHOT
exo.jcr.component.ftp
eXo JCR :: Component :: FTP Service
Modified: jcr/branches/1.12.x/exo.jcr.component.statistics/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.component.statistics/pom.xml 2010-10-08 20:=
05:13 UTC (rev 3279)
+++ jcr/branches/1.12.x/exo.jcr.component.statistics/pom.xml 2010-10-08 20:=
06:07 UTC (rev 3280)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-parent
- 1.12.5-GA-SNAPSHOT
+ 1.12.6-GA-SNAPSHOT
exo.jcr.component.statistics
eXo JCR :: Component :: Statistics Provider
Modified: jcr/branches/1.12.x/exo.jcr.component.webdav/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.component.webdav/pom.xml 2010-10-08 20:05:1=
3 UTC (rev 3279)
+++ jcr/branches/1.12.x/exo.jcr.component.webdav/pom.xml 2010-10-08 20:06:0=
7 UTC (rev 3280)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-parent
- 1.12.5-GA-SNAPSHOT
+ 1.12.6-GA-SNAPSHOT
exo.jcr.component.webdav
eXo JCR :: Component :: Webdav Service
Modified: jcr/branches/1.12.x/exo.jcr.connectors.localadapter/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.connectors.localadapter/pom.xml 2010-10-08 =
20:05:13 UTC (rev 3279)
+++ jcr/branches/1.12.x/exo.jcr.connectors.localadapter/pom.xml 2010-10-08 =
20:06:07 UTC (rev 3280)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-parent
- 1.12.5-GA-SNAPSHOT
+ 1.12.6-GA-SNAPSHOT
exo.jcr.connectors.localadapter
rar
Modified: jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/pom.xml 2010=
-10-08 20:05:13 UTC (rev 3279)
+++ jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/pom.xml 2010=
-10-08 20:06:07 UTC (rev 3280)
@@ -22,7 +22,7 @@
org.exoplatform.jcr
exo.jcr.docs.developer
- 1.12.5-GA-SNAPSHOT
+ 1.12.6-GA-SNAPSHOT
=
4.0.0
Modified: jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/pom.xml 2010-10=
-08 20:05:13 UTC (rev 3279)
+++ jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/pom.xml 2010-10=
-08 20:06:07 UTC (rev 3280)
@@ -22,7 +22,7 @@
org.exoplatform.jcr
exo.jcr.docs
- 1.12.5-GA-SNAPSHOT
+ 1.12.6-GA-SNAPSHOT
=
4.0.0
Modified: jcr/branches/1.12.x/exo.jcr.docs/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.docs/pom.xml 2010-10-08 20:05:13 UTC (rev 3=
279)
+++ jcr/branches/1.12.x/exo.jcr.docs/pom.xml 2010-10-08 20:06:07 UTC (rev 3=
280)
@@ -22,7 +22,7 @@
org.exoplatform.jcr
jcr-parent
- 1.12.5-GA-SNAPSHOT
+ 1.12.6-GA-SNAPSHOT
=
4.0.0
Modified: jcr/branches/1.12.x/exo.jcr.framework.command/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.framework.command/pom.xml 2010-10-08 20:05:=
13 UTC (rev 3279)
+++ jcr/branches/1.12.x/exo.jcr.framework.command/pom.xml 2010-10-08 20:06:=
07 UTC (rev 3280)
@@ -12,7 +12,7 @@
org.exoplatform.jcr
jcr-parent
- 1.12.5-GA-SNAPSHOT
+ 1.12.6-GA-SNAPSHOT
exo.jcr.framework.command
eXo JCR :: Framework :: Command
Modified: jcr/branches/1.12.x/exo.jcr.framework.ftpclient/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.framework.ftpclient/pom.xml 2010-10-08 20:0=
5:13 UTC (rev 3279)
+++ jcr/branches/1.12.x/exo.jcr.framework.ftpclient/pom.xml 2010-10-08 20:0=
6:07 UTC (rev 3280)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-parent
- 1.12.5-GA-SNAPSHOT
+ 1.12.6-GA-SNAPSHOT
exo.jcr.framework.ftpclient
eXo JCR :: Framework :: FTP Client
Modified: jcr/branches/1.12.x/exo.jcr.framework.web/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.framework.web/pom.xml 2010-10-08 20:05:13 U=
TC (rev 3279)
+++ jcr/branches/1.12.x/exo.jcr.framework.web/pom.xml 2010-10-08 20:06:07 U=
TC (rev 3280)
@@ -24,7 +24,7 @@
org.exoplatform.jcr
jcr-parent
- 1.12.5-GA-SNAPSHOT
+ 1.12.6-GA-SNAPSHOT
exo.jcr.framework.web
eXo JCR :: Framework :: Web
Modified: jcr/branches/1.12.x/packaging/module/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/packaging/module/pom.xml 2010-10-08 20:05:13 UTC (r=
ev 3279)
+++ jcr/branches/1.12.x/packaging/module/pom.xml 2010-10-08 20:06:07 UTC (r=
ev 3280)
@@ -4,7 +4,7 @@
org.exoplatform.jcr
jcr-parent
- 1.12.5-GA-SNAPSHOT
+ 1.12.6-GA-SNAPSHOT
jcr.packaging.module
pom
Modified: jcr/branches/1.12.x/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/pom.xml 2010-10-08 20:05:13 UTC (rev 3279)
+++ jcr/branches/1.12.x/pom.xml 2010-10-08 20:06:07 UTC (rev 3280)
@@ -29,14 +29,14 @@
=
org.exoplatform.jcr
jcr-parent
- 1.12.5-GA-SNAPSHOT
+ 1.12.6-GA-SNAPSHOT
pom
eXo JCR
=
- scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/jcr/branche=
s/1.12.5-GA_REL
- scm:svn:https://svn.jboss.org/repos/exo-jcr/jcr/b=
ranches/1.12.5-GA_REL
- http://fisheye.jboss.org/browse/exo-jcr/jcr/branches/1.12.5-GA_RE=
L
+ scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/jcr/branche=
s/1.12.x/
+ scm:svn:https://svn.jboss.org/repos/exo-jcr/jcr/b=
ranches/1.12.x/
+ http://fisheye.jboss.org/browse/exo-jcr/jcr/branches/1.12.x
=
--===============8445395669535017625==--
From do-not-reply at jboss.org Fri Oct 8 16:06:42 2010
Content-Type: multipart/mixed; boundary="===============3592306656592063706=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3281 - in jcr/branches/1.12.x:
exo.jcr.connectors.localadapter/src/main/rar/META-INF and 1 other directory.
Date: Fri, 08 Oct 2010 16:06:42 -0400
Message-ID: <201010082006.o98K6g9R005217@svn01.web.mwc.hst.phx2.redhat.com>
--===============3592306656592063706==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: aheritier
Date: 2010-10-08 16:06:42 -0400 (Fri, 08 Oct 2010)
New Revision: 3281
Modified:
jcr/branches/1.12.x/exo.jcr.connectors.localadapter/src/main/rar/META-IN=
F/ra.xml
jcr/branches/1.12.x/pom.xml
Log:
[EXOJCR-XXX] -mUpgrade to next SNAPSHOTs
Modified: jcr/branches/1.12.x/exo.jcr.connectors.localadapter/src/main/rar/=
META-INF/ra.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.connectors.localadapter/src/main/rar/META-I=
NF/ra.xml 2010-10-08 20:06:07 UTC (rev 3280)
+++ jcr/branches/1.12.x/exo.jcr.connectors.localadapter/src/main/rar/META-I=
NF/ra.xml 2010-10-08 20:06:42 UTC (rev 3281)
@@ -25,7 +25,7 @@
JCR repository
exoplatform
- ${project.version}
+ 1.12.6-GA-SNAPSHOT
false
Modified: jcr/branches/1.12.x/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/pom.xml 2010-10-08 20:06:07 UTC (rev 3280)
+++ jcr/branches/1.12.x/pom.xml 2010-10-08 20:06:42 UTC (rev 3281)
@@ -42,9 +42,9 @@
exo-jcr
1.12
- 2.2.5-GA-SNAPSHOT
- 2.3.5-GA-SNAPSHOT
- 2.1.5-GA-SNAPSHOT
+ 2.2.6-GA-SNAPSHOT
+ 2.3.6-GA-SNAPSHOT
+ 2.1.6-GA-SNAPSHOT
1
=
--===============3592306656592063706==--
From do-not-reply at jboss.org Fri Oct 8 17:00:14 2010
Content-Type: multipart/mixed; boundary="===============2406233244890905445=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3282 -
jcr/branches/1.12.x/exo.jcr.connectors.localadapter/src/main/rar/META-INF.
Date: Fri, 08 Oct 2010 17:00:14 -0400
Message-ID: <201010082100.o98L0EOU007265@svn01.web.mwc.hst.phx2.redhat.com>
--===============2406233244890905445==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: aheritier
Date: 2010-10-08 17:00:13 -0400 (Fri, 08 Oct 2010)
New Revision: 3282
Modified:
jcr/branches/1.12.x/exo.jcr.connectors.localadapter/src/main/rar/META-IN=
F/ra.xml
Log:
version in ra.xml isn't hardcoded any more
Modified: jcr/branches/1.12.x/exo.jcr.connectors.localadapter/src/main/rar/=
META-INF/ra.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.connectors.localadapter/src/main/rar/META-I=
NF/ra.xml 2010-10-08 20:06:42 UTC (rev 3281)
+++ jcr/branches/1.12.x/exo.jcr.connectors.localadapter/src/main/rar/META-I=
NF/ra.xml 2010-10-08 21:00:13 UTC (rev 3282)
@@ -25,7 +25,7 @@
JCR repository
exoplatform
- 1.12.6-GA-SNAPSHOT
+ ${project.version}
false
--===============2406233244890905445==--
From do-not-reply at jboss.org Mon Oct 11 05:42:24 2010
Content-Type: multipart/mixed; boundary="===============5146614592068154298=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3283 - in
kernel/trunk/exo.kernel.component.common/src:
main/java/org/exoplatform/services/rpc/impl and 1 other directories.
Date: Mon, 11 Oct 2010 05:42:24 -0400
Message-ID: <201010110942.o9B9gOcU013925@svn01.web.mwc.hst.phx2.redhat.com>
--===============5146614592068154298==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: nfilotto
Date: 2010-10-11 05:42:23 -0400 (Mon, 11 Oct 2010)
New Revision: 3283
Added:
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/s=
ervices/rpc/TopologyChangeEvent.java
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/s=
ervices/rpc/TopologyChangeListener.java
Modified:
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/s=
ervices/rpc/RPCService.java
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/s=
ervices/rpc/impl/RPCServiceImpl.java
kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/s=
ervices/rpc/impl/TestRPCServiceImpl.java
Log:
EXOJCR-967: We now allow to listen to any topology changes
Modified: kernel/trunk/exo.kernel.component.common/src/main/java/org/exopla=
tform/services/rpc/RPCService.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/=
services/rpc/RPCService.java 2010-10-08 21:00:13 UTC (rev 3282)
+++ kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/=
services/rpc/RPCService.java 2010-10-11 09:42:23 UTC (rev 3283)
@@ -130,5 +130,21 @@
* @return true
if the coordinator is the coordinator, false otherwise
* throws RPCException in case the {@link RPCService} is in an illegal =
state
*/
- boolean isCoordinator() throws RPCException; =
+ boolean isCoordinator() throws RPCException;
+ =
+ /**
+ * Register a new {@link TopologyChangeListener}
+ * @param listener the listener to be registered
+ * @throws SecurityException if the {@link SecurityManager} is installe=
d and the call method
+ * doesn't have the {@link RuntimePermission} ACCESS_RPC_SERVICE_=
PERMISSION
+ */
+ void registerTopologyChangeListener(TopologyChangeListener listener) th=
rows SecurityException;
+ =
+ /**
+ * Unregister a {@link TopologyChangeListener} if it exists
+ * @param listener the listener to unregister
+ * @throws SecurityException if the {@link SecurityManager} is installe=
d and the call method
+ * doesn't have the {@link RuntimePermission} ACCESS_RPC_SERVICE_=
PERMISSION
+ */
+ void unregisterTopologyChangeListener(TopologyChangeListener listener) =
throws SecurityException;
}
\ No newline at end of file
Added: kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatfo=
rm/services/rpc/TopologyChangeEvent.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/=
services/rpc/TopologyChangeEvent.java (rev 0)
+++ kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/=
services/rpc/TopologyChangeEvent.java 2010-10-11 09:42:23 UTC (rev 3283)
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.rpc;
+
+/**
+ * The event triggered anytime the cluster has changed of topology
+ * @author Nicolas Fi=
lotto
+ * @version $Id$
+ *
+ */
+public class TopologyChangeEvent
+{
+
+ /**
+ * Indicates whether the current node is the coordinator after this top=
ology change
+ */
+ private final boolean coordinator;
+ =
+ /**
+ * Indicates whether the coordinator has changed
+ */
+ private final boolean coordinatorHasChanged;
+
+ /**
+ * Default constructor
+ * @param coordinatorHasChanged this parameter is set to true
if the =
+ * coordinator has changed, false
otherwise
+ * @param coordinator this parameter is set to true
if the=
current node
+ * is the coordinator, false
otherwise
+ */
+ public TopologyChangeEvent(boolean coordinatorHasChanged, boolean coord=
inator)
+ {
+ this.coordinator =3D coordinator;
+ this.coordinatorHasChanged =3D coordinatorHasChanged;
+ }
+
+ /**
+ * Indicates whether the current node is the coordinator or not after t=
he topology change
+ * @return true
if the current node is the coordinator, false otherwise.
+ */
+ public boolean isCoordinator()
+ {
+ return coordinator;
+ }
+
+ /**
+ * Indicates whether the coordinator has changed after the topology cha=
nge
+ * @return true
if the coordinator has changed, fals=
e
otherwise.
+ */
+ public boolean isCoordinatorHasChanged()
+ {
+ return coordinatorHasChanged;
+ }
+}
Added: kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatfo=
rm/services/rpc/TopologyChangeListener.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/=
services/rpc/TopologyChangeListener.java (rev 0)
+++ kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/=
services/rpc/TopologyChangeListener.java 2010-10-11 09:42:23 UTC (rev 3283)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.rpc;
+
+/**
+ * This interface is used to allow some components to be notified anytime =
the topology
+ * of the cluster changes, in other words any time a member of the cluste=
r leave or join
+ * the cluster.
+ * =
+ * @author Nicolas Fi=
lotto
+ * @version $Id$
+ *
+ */
+public interface TopologyChangeListener
+{
+
+ /**
+ * Called anytime the topology of the cluster changes
+ * @param event the event triggered when the topology changes
+ */
+ void onChange(TopologyChangeEvent event);
+}
Modified: kernel/trunk/exo.kernel.component.common/src/main/java/org/exopla=
tform/services/rpc/impl/RPCServiceImpl.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/=
services/rpc/impl/RPCServiceImpl.java 2010-10-08 21:00:13 UTC (rev 3282)
+++ kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/=
services/rpc/impl/RPCServiceImpl.java 2010-10-11 09:42:23 UTC (rev 3283)
@@ -29,6 +29,8 @@
import org.exoplatform.services.rpc.RPCException;
import org.exoplatform.services.rpc.RPCService;
import org.exoplatform.services.rpc.RemoteCommand;
+import org.exoplatform.services.rpc.TopologyChangeEvent;
+import org.exoplatform.services.rpc.TopologyChangeListener;
import org.jgroups.Address;
import org.jgroups.Channel;
import org.jgroups.ChannelException;
@@ -61,6 +63,7 @@
import java.util.List;
import java.util.Map;
import java.util.Vector;
+import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CountDownLatch;
=
/**
@@ -103,7 +106,7 @@
* The default value of the cluster name
*/
public static final String CLUSTER_NAME =3D "RPCService-Cluster";
-
+ =
/**
* The configurator used to create the JGroups Channel
*/
@@ -151,6 +154,11 @@
* incoming messages.
*/
private final CountDownLatch startSignal =3D new CountDownLatch(1);
+ =
+ /**
+ * All the registered {@link TopologyChangeListener}
+ */
+ private final List listeners =3D new CopyOnWrit=
eArrayList();
=
/**
* Current State of the {@link RPCServiceImpl}
@@ -434,11 +442,35 @@
public void viewAccepted(View view)
{
this.members =3D view.getMembers();
+ Address currentCoordinator =3D coordinator;
this.coordinator =3D members !=3D null && members.size() > 0 ? membe=
rs.get(0) : null;
this.isCoordinator =3D coordinator !=3D null && coordinator.equals(c=
hannel.getLocalAddress());
+ onTopologyChange(currentCoordinator !=3D null && !currentCoordinator=
.equals(coordinator));
}
=
/**
+ * Called anytime the topology has changed, this method will notify all=
the listeners
+ * currently registered
+ * @param coordinatorHasChanged this parameter is set to true
if the =
+ * coordinator has changed, false
otherwise
+ */
+ private void onTopologyChange(boolean coordinatorHasChanged)
+ {
+ TopologyChangeEvent event =3D new TopologyChangeEvent(coordinatorHas=
Changed, isCoordinator);
+ for (TopologyChangeListener listener : listeners)
+ {
+ try
+ {
+ listener.onChange(event);
+ }
+ catch (Exception e)
+ {
+ LOG.warn("An error occurs with the listener of type " + listen=
er.getClass(), e);
+ }
+ }
+ }
+
+ /**
* {@inheritDoc}
*/
public synchronized RemoteCommand registerCommand(RemoteCommand command)
@@ -517,6 +549,40 @@
}
=
/**
+ * {@inheritDoc}
+ */
+ public void registerTopologyChangeListener(TopologyChangeListener liste=
ner) throws SecurityException
+ {
+ SecurityManager security =3D System.getSecurityManager();
+ if (security !=3D null)
+ {
+ security.checkPermission(RPCService.ACCESS_RPC_SERVICE_PERMISSION=
);
+ }
+ if (listener =3D=3D null)
+ {
+ return;
+ }
+ listeners.add(listener); =
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void unregisterTopologyChangeListener(TopologyChangeListener lis=
tener) throws SecurityException
+ {
+ SecurityManager security =3D System.getSecurityManager();
+ if (security !=3D null)
+ {
+ security.checkPermission(RPCService.ACCESS_RPC_SERVICE_PERMISSION=
);
+ }
+ if (listener =3D=3D null)
+ {
+ return;
+ }
+ listeners.remove(listener);
+ }
+
+ /**
* Gives the {@link RemoteCommand} corresponding to the given id
* @param commandId the command id of the command to retrieve
* @return the corresponding {@link RemoteCommand}
Modified: kernel/trunk/exo.kernel.component.common/src/test/java/org/exopla=
tform/services/rpc/impl/TestRPCServiceImpl.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/=
services/rpc/impl/TestRPCServiceImpl.java 2010-10-08 21:00:13 UTC (rev 3282)
+++ kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/=
services/rpc/impl/TestRPCServiceImpl.java 2010-10-11 09:42:23 UTC (rev 3283)
@@ -25,6 +25,8 @@
import org.exoplatform.services.rpc.RPCException;
import org.exoplatform.services.rpc.RemoteCommand;
import org.exoplatform.services.rpc.SingleMethodCallCommand;
+import org.exoplatform.services.rpc.TopologyChangeEvent;
+import org.exoplatform.services.rpc.TopologyChangeListener;
import org.exoplatform.services.rpc.impl.RPCServiceImpl.MemberHasLeftExcep=
tion;
import org.exoplatform.test.BasicTestCase;
import org.jgroups.Address;
@@ -519,7 +521,7 @@
paramConf.setName(RPCServiceImpl.PARAM_JGROUPS_CONFIG);
paramConf.setValue("jar:/conf/portal/udp.xml"); =
params.addParameter(paramConf);
- RPCServiceImpl service1 =3D null, service2 =3D null;
+ RPCServiceImpl service1 =3D null, service2 =3D null; =
try
{
service1 =3D new RPCServiceImpl(container.getContext(), params, c=
onfigManager);
@@ -591,7 +593,7 @@
=
public String execute(Serializable[] args) throws Throwable
{
- Thread.sleep(30000);
+ Thread.sleep(3000);
return "OldCoordinator";
}
}); =
@@ -675,9 +677,31 @@
return "NewCoordinator";
}
};
- service2.registerCommand(LongTask); =
+ service2.registerCommand(LongTask);
+ MyListener listener1 =3D new MyListener();
+ service1.registerTopologyChangeListener(listener1);
+ MyListener listener2 =3D new MyListener();
+ service2.registerTopologyChangeListener(listener2);
+ assertFalse(listener1.coordinatorHasChanged);
+ assertFalse(listener1.isCoordinator);
+ assertEquals(0, listener1.count);
+ assertFalse(listener2.coordinatorHasChanged);
+ assertFalse(listener2.isCoordinator);
+ assertEquals(0, listener2.count);
service1.start();
+ assertFalse(listener1.coordinatorHasChanged);
+ assertTrue(listener1.isCoordinator);
+ assertEquals(1, listener1.count);
+ assertFalse(listener2.coordinatorHasChanged);
+ assertFalse(listener2.isCoordinator);
+ assertEquals(0, listener2.count);
service2.start();
+ assertFalse(listener1.coordinatorHasChanged);
+ assertTrue(listener1.isCoordinator);
+ assertEquals(2, listener1.count);
+ assertFalse(listener2.coordinatorHasChanged);
+ assertFalse(listener2.isCoordinator);
+ assertEquals(1, listener2.count);
assertEquals(true, service1.isCoordinator());
assertEquals(false, service2.isCoordinator());
List result;
@@ -740,6 +764,12 @@
};
t.start();
service1.stop();
+ assertFalse(listener1.coordinatorHasChanged);
+ assertTrue(listener1.isCoordinator);
+ assertEquals(2, listener1.count);
+ assertTrue(listener2.coordinatorHasChanged);
+ assertTrue(listener2.isCoordinator);
+ assertEquals(2, listener2.count); =
doneSignal.await();
assertNull(error.get() !=3D null ? error.get().getMessage() : "",=
error.get());
result =3D service2.excecuteCommand(allMembers, OK, true, 0);
@@ -1081,4 +1111,22 @@
return (short)(values[0] + 3);
}
}
+ =
+ private static class MyListener implements TopologyChangeListener
+ {
+
+ private boolean coordinatorHasChanged;
+ private boolean isCoordinator;
+ private int count;
+ =
+ /**
+ * @see org.exoplatform.services.rpc.TopologyChangeListener#onChange=
(org.exoplatform.services.rpc.TopologyChangeEvent)
+ */
+ public void onChange(TopologyChangeEvent event)
+ {
+ this.coordinatorHasChanged =3D event.isCoordinatorHasChanged();
+ this.isCoordinator =3D event.isCoordinator();
+ count++;
+ }
+ }
}
--===============5146614592068154298==--
From do-not-reply at jboss.org Mon Oct 11 05:43:42 2010
Content-Type: multipart/mixed; boundary="===============2494281459706247785=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3284 -
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/kernel.
Date: Mon, 11 Oct 2010 05:43:42 -0400
Message-ID: <201010110943.o9B9hgDw013944@svn01.web.mwc.hst.phx2.redhat.com>
--===============2494281459706247785==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: nfilotto
Date: 2010-10-11 05:43:42 -0400 (Mon, 11 Oct 2010)
New Revision: 3284
Modified:
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/=
modules/kernel/rpc-service.xml
Log:
EXOJCR-967: Doc about the TopologyChangeListener
Modified: jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook=
/en-US/modules/kernel/rpc-service.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US=
/modules/kernel/rpc-service.xml 2010-10-11 09:42:23 UTC (rev 3283)
+++ jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US=
/modules/kernel/rpc-service.xml 2010-10-11 09:43:42 UTC (rev 3284)
@@ -18,12 +18,31 @@
something happened or to collect some information from the other
nodes.
=
- The RPCService relies on 2 main interfaces
- which are the org.exoplatform.services.rpc.RPCService
- that defines the service itslef and the
- org.exoplatform.services.rpc.RemoteCommand that
- defines the command that we can execute on other nodes. The arguments =
that
- will be given to the RemoteCommand must be
+ The RPCService relies on 3 main interfaces
+ which are:
+
+
+
+ The org.exoplatform.services.rpc.RPCService
+ that defines the service itslef
+
+
+
+ The
+ org.exoplatform.services.rpc.RemoteCommand th=
at
+ defines the command that we can execute on other nodes.
+
+
+
+ The
+ org.exoplatform.services.rpc.TopologyChangeListener
+ that defines the listeners that will be notified anytime the topol=
ogy
+ of the cluster changes.
+
+
+
+ The arguments that will be given to the
+ RemoteCommand must be
Serializable and its return type also in order to
prevent any issue due to the serialization. To prevent to execute any
RemoteCommand that could be malicious and to allo=
w to
--===============2494281459706247785==--
From do-not-reply at jboss.org Mon Oct 11 06:01:46 2010
Content-Type: multipart/mixed; boundary="===============4117267127722775311=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3285 -
kernel/trunk/exo.kernel.component.common.
Date: Mon, 11 Oct 2010 06:01:45 -0400
Message-ID: <201010111001.o9BA1jEX015224@svn01.web.mwc.hst.phx2.redhat.com>
--===============4117267127722775311==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: nfilotto
Date: 2010-10-11 06:01:45 -0400 (Mon, 11 Oct 2010)
New Revision: 3285
Modified:
kernel/trunk/exo.kernel.component.common/pom.xml
Log:
EXOJCR-967: Parameters for JGroups needed for some Linux Distributions adde=
d to the pom file
Modified: kernel/trunk/exo.kernel.component.common/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kernel/trunk/exo.kernel.component.common/pom.xml 2010-10-11 09:43:42 UT=
C (rev 3284)
+++ kernel/trunk/exo.kernel.component.common/pom.xml 2010-10-11 10:01:45 UT=
C (rev 3285)
@@ -104,6 +104,23 @@
org.apache.maven.plugins
maven-surefire-plugin
+
+
+
+ java.net.preferIPv4Stack
+ true
+
+
+
+ bind.address
+ 127.0.0.1
+
+
+ jgroups.stack
+ udp
+
+ =
**/TransactionTest.java
--===============4117267127722775311==--
From do-not-reply at jboss.org Mon Oct 11 06:03:49 2010
Content-Type: multipart/mixed; boundary="===============1591286902293167009=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] exo-jcr SVN: r3286 - in jcr/trunk:
exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/repository
and 1 other directories.
Date: Mon, 11 Oct 2010 06:03:48 -0400
Message-ID: <201010111003.o9BA3m6R021056@svn01.web.mwc.hst.phx2.redhat.com>
--===============1591286902293167009==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: tolusha
Date: 2010-10-11 06:03:48 -0400 (Mon, 11 Oct 2010)
New Revision: 3286
Modified:
jcr/trunk/applications/exo.jcr.applications.backupconsole/src/main/java/=
org/exoplatform/jcr/backupconsole/BackupClient.java
jcr/trunk/applications/exo.jcr.applications.backupconsole/src/main/java/=
org/exoplatform/jcr/backupconsole/BackupClientImpl.java
jcr/trunk/applications/exo.jcr.applications.backupconsole/src/main/java/=
org/exoplatform/jcr/backupconsole/BackupConsole.java
jcr/trunk/applications/exo.jcr.applications.backupconsole/src/main/java/=
org/exoplatform/jcr/backupconsole/ClientTransportImpl.java
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/j=
cr/ext/repository/RestRepositoryService.java
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/=
modules/jcr/backup/backup-client.xml
Log:
EXOJCR-997: Whole Repository backup support in Backup Console tool
Modified: jcr/trunk/applications/exo.jcr.applications.backupconsole/src/mai=
n/java/org/exoplatform/jcr/backupconsole/BackupClient.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/trunk/applications/exo.jcr.applications.backupconsole/src/main/java=
/org/exoplatform/jcr/backupconsole/BackupClient.java 2010-10-11 10:01:45 UT=
C (rev 3285)
+++ jcr/trunk/applications/exo.jcr.applications.backupconsole/src/main/java=
/org/exoplatform/jcr/backupconsole/BackupClient.java 2010-10-11 10:03:48 UT=
C (rev 3286)
@@ -31,72 +31,108 @@
{
=
/**
- * Start Backup.
+ * Start backup of repository or workspace.
+ * If workspaceName is 'null', then repository backup will be started. =
* =
- * @param repositoryName String, the repository name.
- * @param workspaceName String, the workspace name.
- * @param backupDir path to backup folder on remote server.
- * @return String result.
- * @throws IOException transport exception.
- * @throws BackupExecuteException backup client internal exception.
+ * @param repositoryName =
+ * String, the repository name.
+ * @param workspaceName =
+ * String, the workspace name.
+ * @param backupDir =
+ * path to backup folder on remote server
+ * @return String =
+ * result
+ * @throws IOException =
+ * transport exception.
+ * @throws BackupExecuteException =
+ * backup client internal exception.
*/
String startBackUp(String repositoryName, String workspaceName, String =
backupDir) throws IOException,
BackupExecuteException;
=
/**
- * Start Incremental Backup.
+ * Start Incremental Backup of repository or workspace.
+ * If workspaceName is 'null', then repository backup will be started.
* =
- * @param repositoryName String, the repository name.
- * @param workspaceName String, the workspace name.
- * @param incr incemental job period.
- * @param backupDir path to backup folder on remote server.
- * @return String result.
- * @throws IOException transport exception.
- * @throws BackupExecuteException backup client internal exception.
+ * @param repositoryName =
+ * String, the repository name
+ * @param workspaceName =
+ * String, the workspace name
+ * @param incr =
+ * incremental job period.
+ * @param backupDir =
+ * path to backup folder on remote server
+ * @return String =
+ * result
+ * @throws IOException =
+ * transport exception
+ * @throws BackupExecuteException =
+ * backup client internal exception
*/
String startIncrementalBackUp(String repositoryName, String workspaceNa=
me, String backupDir, long incr)
throws IOException, BackupExecuteException;
=
/**
- * Get Status.
+ * Get Status of backup.
* =
- * @param backupId the backup identifier.
- * @return String result.
- * @throws IOException transport exception.
- * @throws BackupExecuteException backup client internal exception.
+ * @param backupId =
+ * the backup identifier.
+ * @return String =
+ * result.
+ * @throws IOException =
+ * transport exception.
+ * @throws BackupExecuteException =
+ * backup client internal exception.
*/
String status(String backupId) throws IOException, BackupExecuteExcepti=
on;
=
/**
* Get information about backup service.
* =
- * @return String result.
- * @throws IOException transport exception.
- * @throws BackupExecuteException backup client internal exception.
+ * @return String =
+ * result
+ * @throws IOException =
+ * transport exception
+ * @throws BackupExecuteException =
+ * backup client internal exception
*/
String info() throws IOException, BackupExecuteException;
=
/**
- * Get information about current restores.
+ * Get information about current restores of repository or workspace.
+ * If workspaceName is 'null', then will be get status of repository ba=
ckup.
* =
- * @param repositoryName String, the repository name.
- * @param workspaceName String, the workspace name.
- * @return String result.
- * @throws IOException transport exception.
- * @throws BackupExecuteException backup client internal exception.
+ * @param repositoryName =
+ * String, the repository name
+ * @param workspaceName =
+ * String, the workspace name
+ * @return String =
+ * result
+ * @throws IOException =
+ * transport exception
+ * @throws BackupExecuteException =
+ * backup client internal exception
*/
String restores(String repositoryName, String workspaceName) throws IOE=
xception, BackupExecuteException;
=
/**
- * Restore repository from backup file.
+ * Restore repository or workspace from backup file.
+ * If workspaceName is 'null', then will be run restore of repository.
* =
- * @param repositoryName String, the repository name.
- * @param workspaceName String, the workspace name.
- * @param backupId the backup identifier.
- * @param config InputStream contains workspace configuration.
- * @return String result.
- * @throws IOException transport exception.
- * @throws BackupExecuteException backup client internal exception.
+ * @param repositoryName =
+ * String, the repository name
+ * @param workspaceName =
+ * String, the workspace name
+ * @param backupId =
+ * the backup identifier
+ * @param config =
+ * InputStream contains workspace configuration
+ * @return String =
+ * result
+ * @throws IOException =
+ * transport exception
+ * @throws BackupExecuteException =
+ * backup client internal exception
*/
String restore(String repositoryName, String workspaceName, String back=
upId, InputStream config) throws IOException,
BackupExecuteException;
@@ -104,22 +140,33 @@
/**
* Stop backup.
* =
- * @param backupId the backup identifier.
- * @return String result.
- * @throws IOException transport exception.
- * @throws BackupExecuteException backup client internal exception.
+ * @param backupId =
+ * the backup identifier
+ * @return String =
+ * result
+ * @throws IOException =
+ * transport exception
+ * @throws BackupExecuteException =
+ * backup client internal exception
*/
String stop(String backupId) throws IOException, BackupExecuteException;
=
/**
- * Drop backup.
+ * Drop workspace or repository.
+ * If workspaceName is 'null', then repository will be dropped.
* =
- * @param forceClose force sessions close on droped workspace.
- * @param repositoryName String, the repository name.
- * @param workspaceName String, the workspace name.
- * @return String result.
- * @throws IOException transport exception.
- * @throws BackupExecuteException backup client internal exception.
+ * @param forceClose =
+ * force sessions close on repository or workspace
+ * @param repositoryName =
+ * String, the repository name
+ * @param workspaceName =
+ * String, the workspace name
+ * @return String =
+ * result
+ * @throws IOException =
+ * transport exception
+ * @throws BackupExecuteException =
+ * backup client internal exception
*/
String drop(boolean forceClose, String repositoryName, String workspace=
Name) throws IOException,
BackupExecuteException;
@@ -127,18 +174,24 @@
/**
* Get information about the current backups (in progress).
*
- * @return String result
- * @throws IOException
- * @throws BackupExecuteException
+ * @return String =
+ * result
+ * @throws IOException =
+ * transport exception
+ * @throws BackupExecuteException =
+ * backup client internal exception
*/
String list() throws IOException, BackupExecuteException;
=
/**
* Get information about the completed (ready to restore) backups.
*
- * @return String result
- * @throws IOException
- * @throws BackupExecuteException
+ * @return String =
+ * result
+ * @throws IOException =
+ * transport exception
+ * @throws BackupExecuteException =
+ * backup client internal exception
*/
String listCompleted() throws IOException, BackupExecuteException;
=
Modified: jcr/trunk/applications/exo.jcr.applications.backupconsole/src/mai=
n/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/trunk/applications/exo.jcr.applications.backupconsole/src/main/java=
/org/exoplatform/jcr/backupconsole/BackupClientImpl.java 2010-10-11 10:01:4=
5 UTC (rev 3285)
+++ jcr/trunk/applications/exo.jcr.applications.backupconsole/src/main/java=
/org/exoplatform/jcr/backupconsole/BackupClientImpl.java 2010-10-11 10:03:4=
8 UTC (rev 3286)
@@ -18,12 +18,22 @@
*/
package org.exoplatform.jcr.backupconsole;
=
+import java.io.ByteArrayInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+
+import javax.ws.rs.core.Response;
+
import org.exoplatform.services.jcr.config.RepositoryConfigurationExceptio=
n;
import org.exoplatform.services.jcr.config.RepositoryEntry;
import org.exoplatform.services.jcr.config.RepositoryServiceConfiguration;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
import org.exoplatform.services.jcr.ext.backup.BackupJob;
import org.exoplatform.services.jcr.ext.backup.BackupManager;
+import org.exoplatform.services.jcr.ext.backup.RepositoryBackupChain;
+import org.exoplatform.services.jcr.ext.backup.impl.JobRepositoryRestore;
import org.exoplatform.services.jcr.ext.backup.impl.JobWorkspaceRestore;
import org.exoplatform.services.jcr.ext.backup.server.HTTPBackupAgent;
import org.exoplatform.services.jcr.ext.backup.server.bean.BackupConfigBea=
n;
@@ -31,6 +41,7 @@
import org.exoplatform.services.jcr.ext.backup.server.bean.response.Detail=
edInfo;
import org.exoplatform.services.jcr.ext.backup.server.bean.response.ShortI=
nfo;
import org.exoplatform.services.jcr.ext.backup.server.bean.response.ShortI=
nfoList;
+import org.exoplatform.services.jcr.ext.repository.RestRepositoryService;
import org.exoplatform.ws.frameworks.json.JsonHandler;
import org.exoplatform.ws.frameworks.json.JsonParser;
import org.exoplatform.ws.frameworks.json.impl.BeanBuilder;
@@ -44,550 +55,1080 @@
import org.jibx.runtime.IUnmarshallingContext;
import org.jibx.runtime.JiBXException;
=
-import java.io.ByteArrayInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-
-import javax.ws.rs.core.Response;
-
/**
* Created by The eXo Platform SAS. Date:
* =
* @author Karpenko Sergiy
* @version $Id: BackupClientImpl.java 111 2008-11-11 11:11:11Z serg $
*/
-public class BackupClientImpl implements BackupClient {
+public class BackupClientImpl
+ implements BackupClient
+{
=
- /**
- * Block size.
- */
- private static final int BLOCK_SIZE =3D 1024;
+ /**
+ * Block size.
+ */
+ private static final int BLOCK_SIZE =3D 1024;
=
- /**
- * Client transport.
- */
- private ClientTransport transport;
- =
- /**
- * The URL path.
- */
- private final String path;
+ /**
+ * Client transport.
+ */
+ private ClientTransport transport;
=
- /**
- * User login.
- */
- private final String userName;
+ /**
+ * The URL path.
+ */
+ private final String path;
=
- /**
- * User password.
- */
- private final String pass;
- =
- /**
- * Constructor.
- * =
- * @param transport ClientTransport implementation.
- * @param login user login.
- * @param pass user password.
- */
- public BackupClientImpl(ClientTransport transport, String login, String =
pass, String urlPath) {
- this.transport =3D transport;
- this.userName =3D login;
- this.pass =3D pass;
- =
- if (urlPath =3D=3D null)
- path =3D "/rest";
- else
- path =3D urlPath;
- }
- =
- /**
- * {@inheritDoc}
- */
- public String startBackUp(String repositoryName, String workspaceName, S=
tring backupDir) throws IOException, BackupExecuteException {
- String sURL =3D path + HTTPBackupAgent.Constants.BASE_URL + =
- HTTPBackupAgent.Constants.OperationType.START_BACKUP +
- "/" + repositoryName +
- "/" + workspaceName;
+ /**
+ * User login.
+ */
+ private final String userName;
=
- BackupConfigBean bean =3D new BackupConfigBean(BackupManager.FULL_BACK=
UP_ONLY,
- backupDir);
- =
- JsonGeneratorImpl generatorImpl =3D new JsonGeneratorImpl();
- JsonValue json;
- try {
- json =3D generatorImpl.createJsonObject(bean);
- } catch (JsonException e) {
- throw new BackupExecuteException("Can not get json from : " + bean.=
getClass().toString(), e);
- }
- =
- BackupAgentResponse response =3D transport.executePOST(sURL, json.toS=
tring());
- =
- if (response.getStatus() =3D=3D Response.Status.OK.getStatusCode()) {
- return "\nSuccessful : \n" +
- "\tstatus code =3D " + response.getStatus() + "\n";
- } else {
- return failureProcessing(response);
- } =
- }
+ /**
+ * User password.
+ */
+ private final String pass;
=
- /**
- * {@inheritDoc}
- */
- public String startIncrementalBackUp(String repositoryName, String works=
paceName, String backupDir, long incr) throws IOException,
- =
BackupExecuteException {
- String sURL =3D path + HTTPBackupAgent.Constants.BASE_URL + =
- HTTPBackupAgent.Constants.OperationType.START_BACKUP +
- "/" + repositoryName +
- "/" + workspaceName;
+ /**
+ * Constructor.
+ * =
+ * @param transport ClientTransport implementation.
+ * @param login user login.
+ * @param pass user password.
+ */
+ public BackupClientImpl(ClientTransport transport, String login, String=
pass, String urlPath)
+ {
+ this.transport =3D transport;
+ this.userName =3D login;
+ this.pass =3D pass;
=
- BackupConfigBean bean =3D new BackupConfigBean(BackupManager.FULL_AND_=
INCREMENTAL,
- backupDir,
- incr);
- =
- JsonGeneratorImpl generatorImpl =3D new JsonGeneratorImpl();
- JsonValue json;
- try {
- json =3D generatorImpl.createJsonObject(bean);
- } catch (JsonException e) {
- throw new BackupExecuteException("Can not get json from : " + bean.=
getClass().toString(), e);
- }
- =
- BackupAgentResponse response =3D transport.executePOST(sURL, json.toS=
tring());
- =
- if (response.getStatus() =3D=3D Response.Status.OK.getStatusCode()) {
- return "\nSuccessful : \n" +
- "\tstatus code =3D " + response.getStatus() + "\n";
- } else {
- return failureProcessing(response);
- } =
- }
+ if (urlPath =3D=3D null)
+ path =3D "/rest";
+ else
+ path =3D urlPath;
+ }
=
- /**
- * {@inheritDoc}
- */
- public String status(String backupId) throws IOException, BackupExecuteE=
xception {
- String sURL =3D path + HTTPBackupAgent.Constants.BASE_URL + =
- HTTPBackupAgent.Constants.OperationType.CURRENT_OR_COMPL=
ETED_BACKUP_INFO + =
- "/" + backupId;
+ /**
+ * {@inheritDoc}
+ */
+ public String startBackUp(String repositoryName, String workspaceName, =
String backupDir) throws IOException,
+ BackupExecuteException
+ {
+ if (workspaceName !=3D null)
+ {
+ String sURL =3D
+ path + HTTPBackupAgent.Constants.BASE_URL + HTTPBackupAg=
ent.Constants.OperationType.START_BACKUP
+ + "/" + repositoryName + "/" + workspaceName;
=
- BackupAgentResponse response =3D transport.executeGET(sURL);
- =
- if (response.getStatus() =3D=3D Response.Status.OK.getStatusCode()) {
- DetailedInfo info;
- try {
- info =3D (DetailedInfo) getObject(DetailedInfo.class, response.get=
ResponseData());
- } catch (Exception e) {
- throw new RuntimeException("Can not get DetailedInfo from responc=
e.", e);
+ BackupConfigBean bean =3D new BackupConfigBean(BackupManager.FULL=
_BACKUP_ONLY, backupDir);
+
+ JsonGeneratorImpl generatorImpl =3D new JsonGeneratorImpl();
+ JsonValue json;
+ try
+ {
+ json =3D generatorImpl.createJsonObject(bean);
+ }
+ catch (JsonException e)
+ {
+ throw new BackupExecuteException("Can not get json from : " +=
bean.getClass().toString(), e);
+ }
+
+ BackupAgentResponse response =3D transport.executePOST(sURL, json=
.toString());
+
+ if (response.getStatus() =3D=3D Response.Status.OK.getStatusCode(=
))
+ {
+ return "\nSuccessful : \n" + "\tstatus code =3D " + response.g=
etStatus() + "\n";
+ }
+ else
+ {
+ return failureProcessing(response);
+ }
}
- =
- if (info.getType() =3D=3D DetailedInfo.COMPLETED) {
- String result =3D "\nThe completed (ready to restore) backup infor=
mation : \n";
- =
- BackupConfigBean configBean =3D info.getBackupConfig();
- =
- result +=3D ("\t\tbackup id : " + info.getBackupId(=
) + "\n" =
- + "\t\tbackup folder : " + configBean.getBacku=
pDir() + "\n" =
- + "\t\trepository name : " + info.getRepositoryN=
ame() + "\n"
- + "\t\tworkspace name : " + info.getWorkspaceNa=
me() + "\n"
- + "\t\tbackup type : " + (configBean.getBack=
upType() =3D=3D BackupManager.FULL_AND_INCREMENTAL ? "full + incremetal" : =
"full only") + "\n"
- + "\t\tstarted time : " + info.getStartedTime=
() + "\n"
- + (info.getFinishedTime().equals("") ? "\n" : =
- "\t\tfinished time : " + info.getFinishedTim=
e() + "\n\n"));
- =
- return result;
- } else {
- String result =3D "\nThe current backup information : \n";
- =
- BackupConfigBean configBean =3D info.getBackupConfig();
- =
- result +=3D ("\t\tbackup id : " + info.getBackupId=
() + "\n" =
- + "\t\tbackup folder : " + configBean.getBack=
upDir() + "\n" =
- + "\t\trepository name : " + info.getRepository=
Name() + "\n"
- + "\t\tworkspace name : " + info.getWorkspaceN=
ame() + "\n"
- + "\t\tbackup type : " + (configBean.getBac=
kupType() =3D=3D BackupManager.FULL_AND_INCREMENTAL ? "full + incremetal" :=
"full only") + "\n"
- + "\t\tfull backup state : " + getState(info.getS=
tate())) + "\n"
- + (info.getBackupType() =3D=3D BackupManager.FULL_BACKUP=
_ONLY ? "" : =
- "\t\tincremental backup state : " + "working" + "\n")
- + "\t\tstarted time : " + info.getStartedTim=
e() + "\n"
- + (info.getFinishedTime().equals("") ? "\n" : =
- "\t\tfinished time : " + info.getFinishedTi=
me() + "\n\n");
- =
- return result;
+ else
+ {
+ String sURL =3D
+ path + HTTPBackupAgent.Constants.BASE_URL
+ + HTTPBackupAgent.Constants.OperationType.START=
_BACKUP_REPOSITORY + "/" + repositoryName;
+
+ BackupConfigBean bean =3D new BackupConfigBean(BackupManager.FULL=
_BACKUP_ONLY, backupDir);
+
+ JsonGeneratorImpl generatorImpl =3D new JsonGeneratorImpl();
+ JsonValue json;
+ try
+ {
+ json =3D generatorImpl.createJsonObject(bean);
+ }
+ catch (JsonException e)
+ {
+ throw new BackupExecuteException("Can not get json from : " +=
bean.getClass().toString(), e);
+ }
+
+ BackupAgentResponse response =3D transport.executePOST(sURL, json=
.toString());
+
+ if (response.getStatus() =3D=3D Response.Status.OK.getStatusCode(=
))
+ {
+ return "\nSuccessful : \n" + "\tstatus code =3D " + response.g=
etStatus() + "\n";
+ }
+ else
+ {
+ return failureProcessing(response);
+ }
}
- } else {
- return failureProcessing(response);
- }
- }
+ }
=
- /**
- * {@inheritDoc}
- */
- public String stop(String backupId) throws IOException, BackupExecuteExc=
eption {
- String sURL =3D path + HTTPBackupAgent.Constants.BASE_URL + =
- HTTPBackupAgent.Constants.OperationType.STOP_BACKUP + =
- "/" + backupId;
+ /**
+ * {@inheritDoc}
+ */
+ public String startIncrementalBackUp(String repositoryName, String work=
spaceName, String backupDir, long incr)
+ throws IOException, BackupExecuteException
+ {
+ if (workspaceName !=3D null)
+ {
+ String sURL =3D
+ path + HTTPBackupAgent.Constants.BASE_URL + HTTPBackupAg=
ent.Constants.OperationType.START_BACKUP
+ + "/" + repositoryName + "/" + workspaceName;
=
- BackupAgentResponse response =3D transport.executeGET(sURL);
- =
- if (response.getStatus() =3D=3D Response.Status.OK.getStatusCode()) {
- return "\nSuccessful : \n" +
- "\tstatus code =3D " + response.getStatus() + "\n";
- } else {
- return failureProcessing(response);
- } =
- }
+ BackupConfigBean bean =3D new BackupConfigBean(BackupManager.FULL=
_AND_INCREMENTAL, backupDir, incr);
=
- /**
- * {@inheritDoc}
- */
- public String restore(String repositoryName, String workspaceName, Strin=
g backupId, InputStream config) throws IOException,
- =
BackupExecuteException {
- String sURL =3D path + HTTPBackupAgent.Constants.BASE_URL + =
- HTTPBackupAgent.Constants.OperationType.RESTORE +
- "/" + repositoryName +
- "/" + backupId;
+ JsonGeneratorImpl generatorImpl =3D new JsonGeneratorImpl();
+ JsonValue json;
+ try
+ {
+ json =3D generatorImpl.createJsonObject(bean);
+ }
+ catch (JsonException e)
+ {
+ throw new BackupExecuteException("Can not get json from : " +=
bean.getClass().toString(), e);
+ }
=
- =
- WorkspaceEntry wEntry =3D null;
- try {
- wEntry =3D getWorkspaceEntry(config, repositoryName, workspaceName);
- } catch (Throwable e) {
- throw new BackupExecuteException("Can not get WorkspaceEntry for work=
space '" + workspaceName + "' from config.", e); =
- }
- =
- JsonGeneratorImpl generatorImpl =3D new JsonGeneratorImpl();
- JsonValue json;
- =
- try {
- json =3D generatorImpl.createJsonObject(wEntry);
- } catch (JsonException e) {
- throw new BackupExecuteException("Can not get json from : " + wEntr=
y.getClass().toString(), e);
- }
- =
- BackupAgentResponse response =3D transport.executePOST(sURL, json.toS=
tring());
- =
- if (response.getStatus() =3D=3D Response.Status.OK.getStatusCode()) {
- return "\nSuccessful : \n" +
- "\tstatus code =3D " + response.getStatus() + "\n";
- } else {
- return failureProcessing(response);
- }
- }
+ BackupAgentResponse response =3D transport.executePOST(sURL, json=
.toString());
=
- /**
- * {@inheritDoc}
- */
- public String drop(boolean forceClose, String repositoryName, String wor=
kspaceName) throws IOException,
- BackupExecuteExce=
ption {
- String sURL =3D path + HTTPBackupAgent.Constants.BASE_URL + =
- HTTPBackupAgent.Constants.OperationType.DROP_WORKSPACE +
- "/" + repositoryName +
- "/" + workspaceName + =
- "/" + forceClose;
+ if (response.getStatus() =3D=3D Response.Status.OK.getStatusCode(=
))
+ {
+ return "\nSuccessful : \n" + "\tstatus code =3D " + response.g=
etStatus() + "\n";
+ }
+ else
+ {
+ return failureProcessing(response);
+ }
+ }
+ else
+ {
+ String sURL =3D
+ path + HTTPBackupAgent.Constants.BASE_URL
+ + HTTPBackupAgent.Constants.OperationType.START=
_BACKUP_REPOSITORY + "/" + repositoryName;
=
- BackupAgentResponse response =3D transport.executeGET(sURL);
- =
- if (response.getStatus() =3D=3D Response.Status.OK.getStatusCode()) {
- return "\nSuccessful : \n" +
- "\tstatus code =3D " + response.getStatus() + "\n";
- } else {
- return failureProcessing(response);
- } =
- }
+ BackupConfigBean bean =3D new BackupConfigBean(BackupManager.FULL=
_AND_INCREMENTAL, backupDir, incr);
=
- /**
- * {@inheritDoc}
- */
- public String info() throws IOException, BackupExecuteException {
- String sURL =3D path + HTTPBackupAgent.Constants.BASE_URL + HTTPBackup=
Agent.Constants.OperationType.BACKUP_SERVICE_INFO;
- BackupAgentResponse response =3D transport.executeGET(sURL);
- =
- if (response.getStatus() =3D=3D Response.Status.OK.getStatusCode()) {
- BackupServiceInfoBean info;
- try {
- info =3D (BackupServiceInfoBean) getObject(BackupServiceInfoBean.c=
lass, response.getResponseData());
- } catch (Exception e) {
- throw new RuntimeException("Can not get BackupServiceInfoBean fro=
m responce.", e);
+ JsonGeneratorImpl generatorImpl =3D new JsonGeneratorImpl();
+ JsonValue json;
+ try
+ {
+ json =3D generatorImpl.createJsonObject(bean);
+ }
+ catch (JsonException e)
+ {
+ throw new BackupExecuteException("Can not get json from : " +=
bean.getClass().toString(), e);
+ }
+
+ BackupAgentResponse response =3D transport.executePOST(sURL, json=
.toString());
+
+ if (response.getStatus() =3D=3D Response.Status.OK.getStatusCode(=
))
+ {
+ return "\nSuccessful : \n" + "\tstatus code =3D " + response.g=
etStatus() + "\n";
+ }
+ else
+ {
+ return failureProcessing(response);
+ }
}
- =
- String result =3D "\nThe backup service information : \n"
- + "\tfull backup type : " + info.getFu=
llBackupType() + "\n"
- + "\tincremetal backup type : " + info.getIn=
crementalBackupType() + "\n"
- + "\tbackup log folder : " + info.getBa=
ckupLogDir() + "\n"
- + "\tdefault incremental job period : " + info.getDe=
faultIncrementalJobPeriod() + "\n\n";
- =
- return result;
- } else {
- return failureProcessing(response);
- } =
- }
=
- /**
- * {@inheritDoc}
- */
- public String list() throws IOException, BackupExecuteException {
- String sURL =3D path + HTTPBackupAgent.Constants.BASE_URL + HTTPBackup=
Agent.Constants.OperationType.CURRENT_BACKUPS_INFO;
- BackupAgentResponse response =3D transport.executeGET(sURL);
- =
- if (response.getStatus() =3D=3D Response.Status.OK.getStatusCode()) {
- ShortInfoList infoList;
- try {
- infoList =3D (ShortInfoList) getObject(ShortInfoList.class, respon=
se.getResponseData());
- } catch (Exception e) {
- throw new RuntimeException("Can not get ShortInfoList from respon=
ce.", e);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String status(String backupId) throws IOException, BackupExecute=
Exception
+ {
+
+ String sURL =3D
+ path + HTTPBackupAgent.Constants.BASE_URL
+ + HTTPBackupAgent.Constants.OperationType.CURRENT_=
OR_COMPLETED_BACKUP_REPOSITORY_INFO + "/"
+ + backupId;
+
+ BackupAgentResponse response =3D transport.executeGET(sURL);
+
+ if (response.getStatus() !=3D Response.Status.OK.getStatusCode())
+ {
+
+ sURL =3D
+ path + HTTPBackupAgent.Constants.BASE_URL
+ + HTTPBackupAgent.Constants.OperationType.CURRE=
NT_OR_COMPLETED_BACKUP_INFO + "/" + backupId;
+
+ response =3D transport.executeGET(sURL);
}
- =
- String result =3D "\nThe current backups information : \n";
- =
- if (infoList.getBackups().size() =3D=3D 0)
- result +=3D "\tNo active backups.\n\n";
- =
- int count =3D 1;
- for (ShortInfo shortInfo : infoList.getBackups()) {
- result +=3D "\t" + count + ") Backup with id " + shortInfo.getBack=
upId() + " :\n";
- =
- result +=3D ("\t\trepository name : " + shortInfo.getRe=
positoryName() + "\n"
- + "\t\tworkspace name : " + shortInfo.getWork=
spaceName() + "\n"
- + "\t\tbackup type : " + (shortInfo.getBac=
kupType() =3D=3D BackupManager.FULL_AND_INCREMENTAL ? "full + incremetal" :=
"full only") + "\n" =
- + "\t\tfull backup state : " + getState(shortInf=
o.getState())) + "\n"
- + (shortInfo.getBackupType() =3D=3D BackupManager.FULL_B=
ACKUP_ONLY ? "" : =
- "\t\tincremental backup state : " + "working" + "\n")
- + "\t\tstarted time : " + shortInfo.getStar=
tedTime() + "\n"
- + (shortInfo.getFinishedTime().equals("") ? "" : =
- "\t\tfinished time : " + shortInfo.getFini=
shedTime() + "\n");
- count++;
- } =
- =
- return result;
- } else {
- return failureProcessing(response);
- }
- }
=
- /**
- * {@inheritDoc}
- */
- public String listCompleted() throws IOException, BackupExecuteException=
{
- String sURL =3D path + HTTPBackupAgent.Constants.BASE_URL + HTTPBackup=
Agent.Constants.OperationType.COMPLETED_BACKUPS_INFO;
- BackupAgentResponse response =3D transport.executeGET(sURL);
- =
- if (response.getStatus() =3D=3D Response.Status.OK.getStatusCode()) {
- ShortInfoList infoList;
- try {
- infoList =3D (ShortInfoList) getObject(ShortInfoList.class, respon=
se.getResponseData());
- new String(response.getResponseData());
- } catch (Exception e) {e.printStackTrace();
- throw new RuntimeException("Can not get ShortInfoList from respon=
ce.", e);
+ if (response.getStatus() =3D=3D Response.Status.OK.getStatusCode())
+ {
+ DetailedInfo info;
+ try
+ {
+ info =3D (DetailedInfo) getObject(DetailedInfo.class, response=
.getResponseData());
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Can not get DetailedInfo from resp=
once.", e);
+ }
+
+ if (info.getType() =3D=3D DetailedInfo.COMPLETED)
+ {
+ String result =3D "\nThe completed (ready to restore) backup i=
nformation : \n";
+
+ BackupConfigBean configBean =3D info.getBackupConfig();
+
+ result +=3D
+ ("\t\tbackup id : "
+ + info.getBackupId()
+ + "\n"
+ + "\t\tbackup folder : "
+ + configBean.getBackupDir()
+ + "\n"
+ + "\t\trepository name : "
+ + info.getRepositoryName()
+ + "\n"
+ + (info.getWorkspaceName().equals("") ? "" :=
"\t\tworkspace name : "
+ + info.getWorkspaceName() + "\n")
+ + "\t\tbackup type : "
+ + (configBean.getBackupType() =3D=3D BackupM=
anager.FULL_AND_INCREMENTAL ? "full + incremetal"
+ : "full only") + "\n" + "\t\tstarte=
d time : " + info.getStartedTime()
+ + "\n" + (info.getFinishedTime().equals("") =
? "\n" : "\t\tfinished time : "
+ + info.getFinishedTime() + "\n\n"));
+
+ return result;
+ }
+ else
+ {
+ String result =3D "\nThe current backup information : \n";
+
+ BackupConfigBean configBean =3D info.getBackupConfig();
+
+ result +=3D
+ ("\t\tbackup id : "
+ + info.getBackupId()
+ + "\n"
+ + "\t\tbackup folder : "
+ + configBean.getBackupDir()
+ + "\n"
+ + "\t\trepository name : "
+ + info.getRepositoryName()
+ + "\n"
+ + (info.getWorkspaceName().equals("") ? "" :=
"\t\tworkspace name : "
+ + info.getWorkspaceName() + "\n")
+ + "\t\tbackup type : "
+ + (configBean.getBackupType() =3D=3D BackupM=
anager.FULL_AND_INCREMENTAL ? "full + incremetal"
+ : "full only") + "\n" + "\t\tfull b=
ackup state : " + getState(info
+ .getState()))
+ + "\n"
+ + (info.getBackupType() =3D=3D BackupManager=
.FULL_BACKUP_ONLY ? ""
+ : "\t\tincremental backup state : "=
+ "working" + "\n")
+ + "\t\tstarted time : "
+ + info.getStartedTime()
+ + "\n"
+ + (info.getFinishedTime().equals("") ? "\n" =
: "\t\tfinished time : "
+ + info.getFinishedTime() + "\n\n");
+
+ return result;
+ }
}
- =
- String result =3D "\nThe completed (ready to restore) backups inform=
ation : \n";
- =
- if (infoList.getBackups().size() =3D=3D 0)
- result +=3D "\tNo completed backups.\n\n";
- =
- int count =3D 1;
- for (ShortInfo shortInfo : infoList.getBackups()) {
- result +=3D "\t" + count + ") Backup with id " + shortInfo.getBack=
upId() + " :\n";
- =
- result +=3D ("\t\trepository name : " + shortInfo.getRe=
positoryName() + "\n"
- + "\t\tworkspace name : " + shortInfo.getWork=
spaceName() + "\n"
- + "\t\tbackup type : " + (shortInfo.getBac=
kupType() =3D=3D BackupManager.FULL_AND_INCREMENTAL ? "full + incremetal" :=
"full only") + "\n" =
- + "\t\tstarted time : " + shortInfo.getStar=
tedTime() + "\n"
- + (shortInfo.getFinishedTime().equals("") ? "\n" : =
- "\t\tfinished time : " + shortInfo.getFini=
shedTime() + "\n"));
- count++;
- } =
- =
- return result;
- } else {
- return failureProcessing(response);
- }
- }
+ else
+ {
+ return failureProcessing(response);
+ }
+ }
=
- /**
- * {@inheritDoc}
- */
- public String restores(String repositoryName, String workspaceName) thro=
ws IOException, BackupExecuteException {
- String sURL =3D path + HTTPBackupAgent.Constants.BASE_URL + =
- HTTPBackupAgent.Constants.OperationType.CURRENT_RESTORE_=
INFO_ON_WS +
- "/" + repositoryName +
- "/" + workspaceName;
- BackupAgentResponse response =3D transport.executeGET(sURL);
- =
- if (response.getStatus() =3D=3D Response.Status.OK.getStatusCode()) {
- DetailedInfo info;
- try {
- info =3D (DetailedInfo) getObject(DetailedInfo.class, response.get=
ResponseData());
- } catch (Exception e) {
- throw new RuntimeException("Can not get DetailedInfo from responc=
e.", e);
+ /**
+ * {@inheritDoc}
+ */
+ public String stop(String backupId) throws IOException, BackupExecuteEx=
ception
+ {
+ // first try to find current repository backup
+ String sURL =3D
+ path + HTTPBackupAgent.Constants.BASE_URL
+ + HTTPBackupAgent.Constants.OperationType.CURRENT_=
BACKUPS_REPOSITORY_INFO;
+
+ BackupAgentResponse repositoryResponse =3D transport.executeGET(sURL=
);
+
+ if (repositoryResponse.getStatus() =3D=3D Response.Status.OK.getStat=
usCode())
+ {
+ ShortInfoList repositoryInfoList;
+ try
+ {
+ repositoryInfoList =3D (ShortInfoList) getObject(ShortInfoList=
.class, repositoryResponse.getResponseData());
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Can not get ShortInfoList from res=
ponce.", e);
+ }
+
+ for (ShortInfo info : repositoryInfoList.getBackups())
+ {
+ if (info.getBackupId().equals(backupId))
+ {
+ // repository backup
+ sURL =3D
+ path + HTTPBackupAgent.Constants.BASE_URL
+ + HTTPBackupAgent.Constants.OperationType=
.STOP_BACKUP_REPOSITORY + "/" + backupId;
+ BackupAgentResponse response =3D transport.executeGET(sURL);
+
+ if (response.getStatus() =3D=3D Response.Status.OK.getStatu=
sCode())
+ {
+ return "\nSuccessful : \n" + "\tstatus code =3D " + resp=
onse.getStatus() + "\n";
+ }
+ else
+ {
+ return failureProcessing(response);
+ }
+ }
+ }
}
- =
- =
- String result =3D "\nThe current restores information : \n";
- =
- result +=3D "\tRestore with id " + info.getBackupId() + ":\n";
- =
- BackupConfigBean configBean =3D info.getBackupConfig();
- =
- result +=3D ("\t\tbackup folder : " + configBean.getBac=
kupDir() + "\n" =
- + "\t\trepository name : " + info.getRepositoryN=
ame() + "\n"
- + "\t\tworkspace name : " + info.getWorkspaceNa=
me() + "\n"
- + "\t\tbackup type : " + (configBean.getBack=
upType() =3D=3D BackupManager.FULL_AND_INCREMENTAL ? "full + incremetal" : =
"full only") + "\n"
- + "\t\trestore state : " + getRestoreState(in=
fo.getState()) + "\n"
- + "\t\tstarted time : " + info.getStartedTime=
() + "\n"
- + (info.getFinishedTime().equals("") ? "\n" : =
- "\t\tfinished time : " + info.getFinishedTim=
e() + "\n\n"));
- =
- return result;
- } else {
- return failureProcessing(response);
- }
- }
- =
- =
- /**
- * Will be created the Object from JSON binary data.
- *
- * @param cl =
- * Class
- * @param data
- * binary data (JSON)
- * @return Object
- * @throws Exception
- * will be generated Exception
- */
- private Object getObject(Class cl, byte[] data) throws Exception { =
- JsonHandler jsonHandler =3D new JsonDefaultHandler();
- JsonParser jsonParser =3D new JsonParserImpl();
- InputStream inputStream =3D new ByteArrayInputStream(data);
- jsonParser.parse(inputStream, jsonHandler);
- JsonValue jsonValue =3D jsonHandler.getJsonObject();
=
- return new BeanBuilder().createObject(cl, jsonValue);
- }
- =
- =
- private String getRestoreState(int restoreState) {
- String state =3D "unknown sate of restore";
- =
- switch (restoreState) {
- case JobWorkspaceRestore.RESTORE_INITIALIZED:
- state =3D "initialized";
- break;
- =
- case JobWorkspaceRestore.RESTORE_STARTED:
- state =3D "started";
- break;
- =
- case JobWorkspaceRestore.RESTORE_SUCCESSFUL:
- state =3D "successful";
- break;
- =
- case JobWorkspaceRestore.RESTORE_FAIL:
- state =3D "fail";
- break;
+ // then try to find current workspace backup
+ sURL =3D path + HTTPBackupAgent.Constants.BASE_URL + HTTPBackupAgent=
.Constants.OperationType.CURRENT_BACKUPS_INFO;
=
- default:
- break;
- }
- =
- return state;
- }
- =
- /**
- * getState.
- * =
- * @param state
- * value of state
- * @return String sate
- */
- private String getState(int state) {
- String st =3D "";
- switch (state) {
+ BackupAgentResponse workspaceResponse =3D transport.executeGET(sURL);
+ if (workspaceResponse.getStatus() =3D=3D Response.Status.OK.getStatu=
sCode())
+ {
+ ShortInfoList workspaceInfoList;
+ try
+ {
+ workspaceInfoList =3D (ShortInfoList) getObject(ShortInfoList.=
class, workspaceResponse.getResponseData());
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Can not get ShortInfoList from res=
ponce.", e);
+ }
=
- case BackupJob.FINISHED:
- st =3D "finished";
- break;
+ for (ShortInfo info : workspaceInfoList.getBackups())
+ {
+ if (info.getBackupId().equals(backupId))
+ {
+ // workspace backup
+ sURL =3D
+ path + HTTPBackupAgent.Constants.BASE_URL + HTTPBa=
ckupAgent.Constants.OperationType.STOP_BACKUP
+ + "/" + backupId;
=
- case BackupJob.WORKING:
- st =3D "working";
- break;
+ BackupAgentResponse response =3D transport.executeGET(sURL);
=
- case BackupJob.WAITING:
- st =3D "waiting";
- break;
+ if (response.getStatus() =3D=3D Response.Status.OK.getStatu=
sCode())
+ {
+ return "\nSuccessful : \n" + "\tstatus code =3D " + resp=
onse.getStatus() + "\n";
+ }
+ else
+ {
+ return failureProcessing(response);
+ }
+ }
+ }
+ }
=
- case BackupJob.STARTING:
- st =3D "starting";
- break;
- default:
- break;
- }
+ return "\nFailure :\n" + "\tmessage : There are no active backu=
p with id " + backupId;
+ }
=
- return st;
- }
- =
- /**
- * failureProcessing.
- *
- * @param data
- * response data
- * @return String
- * result
- * @throws BackupExecuteException
- * will be generated BackupExecuteException =
- */
- private String failureProcessing(BackupAgentResponse response) throws Ba=
ckupExecuteException {
- try {
- String result =3D "\nFailure :\n"
- + "\tsatatus code : " + response.getStatus() + "\n"
- + "\tmessage : " + new String(response.getRespo=
nseData(), "UTF-8") + "\n\n";
- =
- return result;
- } catch (UnsupportedEncodingException e) {
- throw new BackupExecuteException("Can not encoded the responce : " +=
e.getMessage(), e);
- }
- }
- =
- /**
- * getWorkspaceEntry.
- *
- * @param wEntryStream
- * InputStream, the workspace configuration
- * @param workspaceName
- * String, the workspace name =
- * @return WorkspaceEntry
- * return the workspace entry
- * @throws FileNotFoundException
- * will be generated the FileNotFoundException =
- * @throws JiBXException
- * will be generated the JiBXException =
- * @throws RepositoryConfigurationException
- * will be generated the RepositoryConfigurationException =
- */
- private WorkspaceEntry getWorkspaceEntry(InputStream wEntryStream, Strin=
g repositoryName, String workspaceName) throws FileNotFoundException,
- =
JiBXException,
- =
RepositoryConfigurationException {
- WorkspaceEntry wsEntry =3D null;
+ /**
+ * {@inheritDoc}
+ */
+ public String restore(String repositoryName, String workspaceName, Stri=
ng backupId, InputStream config)
+ throws IOException, BackupExecuteException
+ {
+ if (workspaceName !=3D null)
+ {
+ String sURL =3D
+ path + HTTPBackupAgent.Constants.BASE_URL + HTTPBackupAg=
ent.Constants.OperationType.RESTORE + "/"
+ + repositoryName + "/" + backupId;
=
- IBindingFactory factory =3D BindingDirectory.getFactory(RepositoryServ=
iceConfiguration.class);
- IUnmarshallingContext uctx =3D factory.createUnmarshallingContext();
- RepositoryServiceConfiguration conf =3D (RepositoryServiceConfiguratio=
n) uctx.unmarshalDocument(wEntryStream,
- =
null);
- RepositoryEntry rEntry =3D conf.getRepositoryConfiguration(repositoryN=
ame);
- =
- for (WorkspaceEntry wEntry : rEntry.getWorkspaceEntries())
- if (wEntry.getName().equals(workspaceName))
- wsEntry =3D wEntry;
- =
+ WorkspaceEntry wEntry =3D null;
+ try
+ {
+ wEntry =3D getWorkspaceEntry(config, repositoryName, workspace=
Name);
+ }
+ catch (Throwable e)
+ {
+ throw new BackupExecuteException("Can not get WorkspaceEntry f=
or workspace '" + workspaceName
+ + "' from config.", e);
+ }
=
- if (wsEntry =3D=3D null)
- throw new RuntimeException("Can not find the workspace '" + workspac=
eName
- + "' in configuration.");
+ JsonGeneratorImpl generatorImpl =3D new JsonGeneratorImpl();
+ JsonValue json;
=
- return wsEntry;
- }
+ try
+ {
+ json =3D generatorImpl.createJsonObject(wEntry);
+ }
+ catch (JsonException e)
+ {
+ throw new BackupExecuteException("Can not get json from : " +=
wEntry.getClass().toString(), e);
+ }
+
+ BackupAgentResponse response =3D transport.executePOST(sURL, json=
.toString());
+
+ if (response.getStatus() =3D=3D Response.Status.OK.getStatusCode(=
))
+ {
+ return "\nSuccessful : \n" + "\tstatus code =3D " + response.g=
etStatus() + "\n";
+ }
+ else
+ {
+ return failureProcessing(response);
+ }
+ }
+ else
+ {
+ String sURL =3D
+ path + HTTPBackupAgent.Constants.BASE_URL
+ + HTTPBackupAgent.Constants.OperationType.RESTO=
RE_REPOSITORY + "/" + backupId;
+
+ RepositoryEntry wEntry =3D null;
+ try
+ {
+ wEntry =3D getRepositoryEntry(config, repositoryName);
+ }
+ catch (Throwable e)
+ {
+ throw new BackupExecuteException("Can not get RepositoryEntry =
for repository '" + repositoryName
+ + "' from config.", e);
+ }
+
+ JsonGeneratorImpl generatorImpl =3D new JsonGeneratorImpl();
+ JsonValue json;
+
+ try
+ {
+ json =3D generatorImpl.createJsonObject(wEntry);
+ }
+ catch (JsonException e)
+ {
+ throw new BackupExecuteException("Can not get json from : " +=
wEntry.getClass().toString(), e);
+ }
+
+ BackupAgentResponse response =3D transport.executePOST(sURL, json=
.toString());
+
+ if (response.getStatus() =3D=3D Response.Status.OK.getStatusCode(=
))
+ {
+ return "\nSuccessful : \n" + "\tstatus code =3D " + response.g=
etStatus() + "\n";
+ }
+ else
+ {
+ return failureProcessing(response);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String drop(boolean forceClose, String repositoryName, String wo=
rkspaceName) throws IOException,
+ BackupExecuteException
+ {
+ if (workspaceName !=3D null)
+ {
+ String sURL =3D
+ path + HTTPBackupAgent.Constants.BASE_URL + HTTPBackupAg=
ent.Constants.OperationType.DROP_WORKSPACE
+ + "/" + repositoryName + "/" + workspaceName + =
"/" + forceClose;
+
+ BackupAgentResponse response =3D transport.executeGET(sURL);
+
+ if (response.getStatus() =3D=3D Response.Status.OK.getStatusCode(=
))
+ {
+ return "\nSuccessful : \n" + "\tstatus code =3D " + response.g=
etStatus() + "\n";
+ }
+ else
+ {
+ return failureProcessing(response);
+ }
+ }
+ else
+ {
+ String sURL =3D
+ path + RestRepositoryService.Constants.BASE_URL
+ + RestRepositoryService.Constants.OperationType=
.REMOVE_REPOSITORY + "/" + repositoryName
+ + "/" + forceClose;
+
+ BackupAgentResponse response =3D transport.executeGET(sURL);
+
+ if (response.getStatus() =3D=3D Response.Status.OK.getStatusCode(=
))
+ {
+ return "\nSuccessful : \n" + "\tstatus code =3D " + response.g=
etStatus() + "\n";
+ }
+ else
+ {
+ return failureProcessing(response);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String info() throws IOException, BackupExecuteException
+ {
+ String sURL =3D
+ path + HTTPBackupAgent.Constants.BASE_URL + HTTPBackupAgent=
.Constants.OperationType.BACKUP_SERVICE_INFO;
+ BackupAgentResponse response =3D transport.executeGET(sURL);
+
+ if (response.getStatus() =3D=3D Response.Status.OK.getStatusCode())
+ {
+ BackupServiceInfoBean info;
+ try
+ {
+ info =3D (BackupServiceInfoBean) getObject(BackupServiceInfoBe=
an.class, response.getResponseData());
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Can not get BackupServiceInfoBean =
from responce.", e);
+ }
+
+ String result =3D
+ "\nThe backup service information : \n" + "\tfull backup=
type : "
+ + info.getFullBackupType() + "\n" + "\tincremet=
al backup type : "
+ + info.getIncrementalBackupType() + "\n" + "\tb=
ackup log folder : "
+ + info.getBackupLogDir() + "\n" + "\tdefault in=
cremental job period : "
+ + info.getDefaultIncrementalJobPeriod() + "\n\n=
";
+
+ return result;
+ }
+ else
+ {
+ return failureProcessing(response);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String list() throws IOException, BackupExecuteException
+ {
+
+ String sURL =3D
+ path + HTTPBackupAgent.Constants.BASE_URL
+ + HTTPBackupAgent.Constants.OperationType.CURRENT_=
BACKUPS_REPOSITORY_INFO;
+ BackupAgentResponse repositoryResponse =3D transport.executeGET(sURL=
);
+
+ sURL =3D path + HTTPBackupAgent.Constants.BASE_URL + HTTPBackupAgent=
.Constants.OperationType.CURRENT_BACKUPS_INFO;
+ BackupAgentResponse workspaceResponse =3D transport.executeGET(sURL);
+
+ if ((repositoryResponse.getStatus() =3D=3D Response.Status.OK.getSta=
tusCode())
+ && (workspaceResponse.getStatus() =3D=3D Response.Status.OK=
.getStatusCode()))
+ {
+ ShortInfoList repositoryInfoList;
+ try
+ {
+ repositoryInfoList =3D (ShortInfoList) getObject(ShortInfoList=
.class, repositoryResponse.getResponseData());
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Can not get ShortInfoList from res=
ponce.", e);
+ }
+
+ ShortInfoList workspaceInfoList;
+ try
+ {
+ workspaceInfoList =3D (ShortInfoList) getObject(ShortInfoList.=
class, workspaceResponse.getResponseData());
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Can not get ShortInfoList from res=
ponce.", e);
+ }
+
+ String result =3D "\nThe current backups information : \n";
+
+ if ((repositoryInfoList.getBackups().size() =3D=3D 0) && (workspa=
ceInfoList.getBackups().size() =3D=3D 0))
+ {
+ result +=3D "\tNo active backups.\n\n";
+ }
+
+ int count =3D 1;
+ for (ShortInfo shortInfo : repositoryInfoList.getBackups())
+ {
+ result +=3D "\t" + count + ") Repository backup with id " + sh=
ortInfo.getBackupId() + " :\n";
+
+ result +=3D
+ ("\t\trepository name : "
+ + shortInfo.getRepositoryName()
+ + "\n"
+ + "\t\tbackup type : "
+ + (shortInfo.getBackupType() =3D=3D BackupMa=
nager.FULL_AND_INCREMENTAL ? "full + incremetal"
+ : "full only") + "\n" + "\t\tfull b=
ackups state : " + getRepositoryBackupToFullState(shortInfo
+ .getState()))
+ + "\n"
+ + (shortInfo.getBackupType() =3D=3D BackupMa=
nager.FULL_BACKUP_ONLY ? ""
+ : "\t\tincremental backups state :=
" + "working" + "\n")
+ + "\t\tstarted time : "
+ + shortInfo.getStartedTime()
+ + "\n"
+ + (shortInfo.getFinishedTime().equals("") ? =
"" : "\t\tfinished time : "
+ + shortInfo.getFinishedTime() + "\n=
");
+ count++;
+ }
+
+ for (ShortInfo shortInfo : workspaceInfoList.getBackups())
+ {
+ result +=3D "\t" + count + ") Workspace backup with id " + sho=
rtInfo.getBackupId() + " :\n";
+
+ result +=3D
+ ("\t\trepository name : "
+ + shortInfo.getRepositoryName()
+ + "\n"
+ + "\t\tworkspace name : "
+ + shortInfo.getWorkspaceName()
+ + "\n"
+ + "\t\tbackup type : "
+ + (shortInfo.getBackupType() =3D=3D BackupMa=
nager.FULL_AND_INCREMENTAL ? "full + incremetal"
+ : "full only") + "\n" + "\t\tfull b=
ackup state : " + getState(shortInfo
+ .getState()))
+ + "\n"
+ + (shortInfo.getBackupType() =3D=3D BackupMa=
nager.FULL_BACKUP_ONLY ? ""
+ : "\t\tincremental backup state :=
" + "working" + "\n")
+ + "\t\tstarted time : "
+ + shortInfo.getStartedTime()
+ + "\n"
+ + (shortInfo.getFinishedTime().equals("") ? =
"" : "\t\tfinished time : "
+ + shortInfo.getFinishedTime() + "\n=
");
+ count++;
+ }
+
+ return result;
+ }
+ else
+ {
+ return failureProcessing(workspaceResponse);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String listCompleted() throws IOException, BackupExecuteException
+ {
+ String sURL =3D
+ path + HTTPBackupAgent.Constants.BASE_URL
+ + HTTPBackupAgent.Constants.OperationType.COMPLETE=
D_BACKUPS_REPOSITORY_INFO;
+ BackupAgentResponse repositoryResponse =3D transport.executeGET(sURL=
);
+
+ sURL =3D path + HTTPBackupAgent.Constants.BASE_URL + HTTPBackupAgent=
.Constants.OperationType.COMPLETED_BACKUPS_INFO;
+ BackupAgentResponse workspaceResponse =3D transport.executeGET(sURL);
+
+ if ((workspaceResponse.getStatus() =3D=3D Response.Status.OK.getStat=
usCode())
+ && (repositoryResponse.getStatus() =3D=3D Response.Status.O=
K.getStatusCode()))
+ {
+
+ ShortInfoList repositoryInfoList;
+ try
+ {
+ repositoryInfoList =3D (ShortInfoList) getObject(ShortInfoList=
.class, repositoryResponse.getResponseData());
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Can not get ShortInfoList from res=
ponce.", e);
+ }
+
+ ShortInfoList workspaceInfoList;
+ try
+ {
+ workspaceInfoList =3D (ShortInfoList) getObject(ShortInfoList.=
class, workspaceResponse.getResponseData());
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Can not get ShortInfoList from res=
ponce.", e);
+ }
+
+ String result =3D "\nThe completed (ready to restore) backups inf=
ormation : \n";
+
+ if ((repositoryInfoList.getBackups().size() =3D=3D 0) && (workspa=
ceInfoList.getBackups().size() =3D=3D 0))
+ {
+ result +=3D "\tNo completed backups.\n\n";
+ }
+
+ int count =3D 1;
+ for (ShortInfo shortInfo : repositoryInfoList.getBackups())
+ {
+ result +=3D "\t" + count + ") Repository backup with id " + sh=
ortInfo.getBackupId() + " :\n";
+
+ result +=3D
+ ("\t\trepository name : "
+ + shortInfo.getRepositoryName()
+ + "\n"
+ + "\t\tbackup type : "
+ + (shortInfo.getBackupType() =3D=3D BackupMa=
nager.FULL_AND_INCREMENTAL ? "full + incremetal"
+ : "full only") + "\n" + "\t\tstarte=
d time : "
+ + shortInfo.getStartedTime() + "\n" + (short=
Info.getFinishedTime().equals("") ? "\n"
+ : "\t\tfinished time : " + short=
Info.getFinishedTime() + "\n"));
+ count++;
+ }
+
+ for (ShortInfo shortInfo : workspaceInfoList.getBackups())
+ {
+ result +=3D "\t" + count + ") Workspace backup with id " + sho=
rtInfo.getBackupId() + " :\n";
+
+ result +=3D
+ ("\t\trepository name : "
+ + shortInfo.getRepositoryName()
+ + "\n"
+ + "\t\tworkspace name : "
+ + shortInfo.getWorkspaceName()
+ + "\n"
+ + "\t\tbackup type : "
+ + (shortInfo.getBackupType() =3D=3D BackupMa=
nager.FULL_AND_INCREMENTAL ? "full + incremetal"
+ : "full only") + "\n" + "\t\tstarte=
d time : "
+ + shortInfo.getStartedTime() + "\n" + (short=
Info.getFinishedTime().equals("") ? "\n"
+ : "\t\tfinished time : " + short=
Info.getFinishedTime() + "\n"));
+ count++;
+ }
+
+ return result;
+ }
+ else
+ {
+ return failureProcessing(workspaceResponse);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String restores(String repositoryName, String workspaceName) thr=
ows IOException, BackupExecuteException
+ {
+ if (workspaceName !=3D null)
+ {
+ String sURL =3D
+ path + HTTPBackupAgent.Constants.BASE_URL
+ + HTTPBackupAgent.Constants.OperationType.CURRE=
NT_RESTORE_INFO_ON_WS + "/" + repositoryName
+ + "/" + workspaceName;
+ BackupAgentResponse response =3D transport.executeGET(sURL);
+
+ if (response.getStatus() =3D=3D Response.Status.OK.getStatusCode(=
))
+ {
+ DetailedInfo info;
+ try
+ {
+ info =3D (DetailedInfo) getObject(DetailedInfo.class, respo=
nse.getResponseData());
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Can not get DetailedInfo from r=
esponce.", e);
+ }
+
+ String result =3D "\nThe current restores information : \n";
+
+ result +=3D "\tWorkspace restore with id " + info.getBackupId(=
) + ":\n";
+
+ BackupConfigBean configBean =3D info.getBackupConfig();
+
+ result +=3D
+ ("\t\tbackup folder : "
+ + configBean.getBackupDir()
+ + "\n"
+ + "\t\trepository name : "
+ + info.getRepositoryName()
+ + "\n"
+ + "\t\tworkspace name : "
+ + info.getWorkspaceName()
+ + "\n"
+ + "\t\tbackup type : "
+ + (configBean.getBackupType() =3D=3D BackupM=
anager.FULL_AND_INCREMENTAL ? "full + incremetal"
+ : "full only") + "\n" + "\t\trestor=
e state : "
+ + getRestoreState(info.getState()) + "\n" + =
"\t\tstarted time : "
+ + info.getStartedTime() + "\n" + (info.getFi=
nishedTime().equals("") ? "\n"
+ : "\t\tfinished time : " + info.ge=
tFinishedTime() + "\n\n"));
+
+ return result;
+ }
+ else
+ {
+ return failureProcessing(response);
+ }
+ }
+ else
+ {
+ String sURL =3D
+ path + HTTPBackupAgent.Constants.BASE_URL
+ + HTTPBackupAgent.Constants.OperationType.CURRE=
NT_RESTORE_INFO_ON_REPOSITORY + "/"
+ + repositoryName;
+
+ BackupAgentResponse response =3D transport.executeGET(sURL);
+
+ if (response.getStatus() =3D=3D Response.Status.OK.getStatusCode(=
))
+ {
+ DetailedInfo info;
+ try
+ {
+ info =3D (DetailedInfo) getObject(DetailedInfo.class, respo=
nse.getResponseData());
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Can not get DetailedInfo from r=
esponce.", e);
+ }
+
+ String result =3D "\nThe current restores information : \n";
+
+ result +=3D "\tRepository restore with id " + info.getBackupId=
() + ":\n";
+
+ BackupConfigBean configBean =3D info.getBackupConfig();
+
+ result +=3D
+ ("\t\tbackup folder : "
+ + configBean.getBackupDir()
+ + "\n"
+ + "\t\trepository name : "
+ + info.getRepositoryName()
+ + "\n"
+ + "\t\tbackup type : "
+ + (configBean.getBackupType() =3D=3D BackupM=
anager.FULL_AND_INCREMENTAL ? "full + incremetal"
+ : "full only") + "\n" + "\t\trestor=
e state : "
+ + getRepositoryRestoreState(info.getState())=
+ "\n" + "\t\tstarted time : "
+ + info.getStartedTime() + "\n" + (info.getFi=
nishedTime().equals("") ? "\n"
+ : "\t\tfinished time : " + info.ge=
tFinishedTime() + "\n\n"));
+
+ return result;
+ }
+ else
+ {
+ return failureProcessing(response);
+ }
+ }
+ }
+
+ /**
+ * Will be created the Object from JSON binary data.
+ *
+ * @param cl =
+ * Class
+ * @param data
+ * binary data (JSON)
+ * @return Object
+ * @throws Exception
+ * will be generated Exception
+ */
+ private Object getObject(Class cl, byte[] data) throws Exception
+ {
+ JsonHandler jsonHandler =3D new JsonDefaultHandler();
+ JsonParser jsonParser =3D new JsonParserImpl();
+ InputStream inputStream =3D new ByteArrayInputStream(data);
+ jsonParser.parse(inputStream, jsonHandler);
+ JsonValue jsonValue =3D jsonHandler.getJsonObject();
+
+ return new BeanBuilder().createObject(cl, jsonValue);
+ }
+
+ private String getRestoreState(int restoreState)
+ {
+ String state =3D "unknown sate of restore";
+
+ switch (restoreState)
+ {
+ case JobWorkspaceRestore.RESTORE_INITIALIZED :
+ state =3D "initialized";
+ break;
+
+ case JobWorkspaceRestore.RESTORE_STARTED :
+ state =3D "started";
+ break;
+
+ case JobWorkspaceRestore.RESTORE_SUCCESSFUL :
+ state =3D "successful";
+ break;
+
+ case JobWorkspaceRestore.RESTORE_FAIL :
+ state =3D "fail";
+ break;
+
+ default :
+ break;
+ }
+
+ return state;
+ }
+
+ private String getRepositoryRestoreState(int restoreState)
+ {
+ String state =3D "unknown sate of restore";
+
+ switch (restoreState)
+ {
+ case JobRepositoryRestore.REPOSITORY_RESTORE_INITIALIZED :
+ state =3D "initialized";
+ break;
+
+ case JobRepositoryRestore.REPOSITORY_RESTORE_STARTED :
+ state =3D "started";
+ break;
+
+ case JobRepositoryRestore.REPOSITORY_RESTORE_SUCCESSFUL :
+ state =3D "successful";
+ break;
+
+ case JobRepositoryRestore.REPOSITORY_RESTORE_FAIL :
+ state =3D "fail";
+ break;
+
+ default :
+ break;
+ }
+
+ return state;
+ }
+
+ /**
+ * getState.
+ * =
+ * @param state
+ * value of state
+ * @return String sate
+ */
+ private String getState(int state)
+ {
+ String st =3D "";
+ switch (state)
+ {
+
+ case BackupJob.FINISHED :
+ st =3D "finished";
+ break;
+
+ case BackupJob.WORKING :
+ st =3D "working";
+ break;
+
+ case BackupJob.WAITING :
+ st =3D "waiting";
+ break;
+
+ case BackupJob.STARTING :
+ st =3D "starting";
+ break;
+ default :
+ break;
+ }
+
+ return st;
+ }
+
+ /**
+ * getState.
+ * =
+ * @param state
+ * value of state
+ * @return String sate
+ */
+ private String getRepositoryBackupToFullState(int state)
+ {
+ String st =3D "";
+ switch (state)
+ {
+
+ case RepositoryBackupChain.FINISHED :
+ st =3D "finished";
+ break;
+
+ case RepositoryBackupChain.WORKING :
+ st =3D "working";
+ break;
+
+ case RepositoryBackupChain.INITIALIZED :
+ st =3D "initialized";
+ break;
+
+ case RepositoryBackupChain.FULL_BACKUP_FINISHED_INCREMENTAL_BACKU=
P_WORKING :
+ st =3D "finished";
+ break;
+ default :
+ break;
+ }
+
+ return st;
+ }
+
+ /**
+ * failureProcessing.
+ *
+ * @param data
+ * response data
+ * @return String
+ * result
+ * @throws BackupExecuteException
+ * will be generated BackupExecuteException =
+ */
+ private String failureProcessing(BackupAgentResponse response) throws B=
ackupExecuteException
+ {
+ try
+ {
+ String result =3D
+ "\nFailure :\n" + "\tstatus code : " + response.getStatu=
s() + "\n" + "\tmessage : "
+ + new String(response.getResponseData(), "UTF-8=
") + "\n\n";
+
+ return result;
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ throw new BackupExecuteException("Can not encoded the responce : =
" + e.getMessage(), e);
+ }
+ }
+
+ /**
+ * getRepositoryEntry.
+ *
+ * @param wEntryStream
+ * InputStream, the workspace configuration
+ * @return RepositoryEntry
+ * return the workspace entry
+ * @throws FileNotFoundException
+ * will be generated the FileNotFoundException =
+ * @throws JiBXException
+ * will be generated the JiBXException =
+ * @throws RepositoryConfigurationException
+ * will be generated the RepositoryConfigurationException =
+ */
+ private RepositoryEntry getRepositoryEntry(InputStream wEntryStream, St=
ring repositoryName)
+ throws FileNotFoundException, JiBXException, RepositoryConfigu=
rationException
+ {
+ IBindingFactory factory =3D BindingDirectory.getFactory(RepositorySe=
rviceConfiguration.class);
+ IUnmarshallingContext uctx =3D factory.createUnmarshallingContext();
+ RepositoryServiceConfiguration conf =3D (RepositoryServiceConfigurat=
ion) uctx.unmarshalDocument(wEntryStream, null);
+ RepositoryEntry rEntry =3D conf.getRepositoryConfiguration(repositor=
yName);
+
+ return rEntry;
+ }
+
+ /**
+ * getWorkspaceEntry.
+ *
+ * @param wEntryStream
+ * InputStream, the workspace configuration
+ * @param workspaceName
+ * String, the workspace name =
+ * @return WorkspaceEntry
+ * return the workspace entry
+ * @throws FileNotFoundException
+ * will be generated the FileNotFoundException =
+ * @throws JiBXException
+ * will be generated the JiBXException =
+ * @throws RepositoryConfigurationException
+ * will be generated the RepositoryConfigurationException =
+ */
+ private WorkspaceEntry getWorkspaceEntry(InputStream wEntryStream, Stri=
ng repositoryName, String workspaceName)
+ throws FileNotFoundException, JiBXException, RepositoryConfigu=
rationException
+ {
+ RepositoryEntry rEntry =3D getRepositoryEntry(wEntryStream, reposito=
ryName);
+
+ WorkspaceEntry wsEntry =3D null;
+
+ for (WorkspaceEntry wEntry : rEntry.getWorkspaceEntries())
+ if (wEntry.getName().equals(workspaceName))
+ wsEntry =3D wEntry;
+
+ if (wsEntry =3D=3D null)
+ throw new RuntimeException("Can not find the workspace '" + works=
paceName + "' in configuration.");
+
+ return wsEntry;
+ }
+
}
Modified: jcr/trunk/applications/exo.jcr.applications.backupconsole/src/mai=
n/java/org/exoplatform/jcr/backupconsole/BackupConsole.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/trunk/applications/exo.jcr.applications.backupconsole/src/main/java=
/org/exoplatform/jcr/backupconsole/BackupConsole.java 2010-10-11 10:01:45 U=
TC (rev 3285)
+++ jcr/trunk/applications/exo.jcr.applications.backupconsole/src/main/java=
/org/exoplatform/jcr/backupconsole/BackupConsole.java 2010-10-11 10:03:48 U=
TC (rev 3286)
@@ -58,25 +58,33 @@
*/
private static final String HELP_INFO =3D
"Help info:\n" + " \n" + " : http(s)//login:pas=
sword(a)host:port/ \n"
- + " : start [] \n" + " =
stop \n"
- + " status \n" + " restores \n"
- + " restore \=
n" + " list [completed] \n"
- + " info \n" + " drop [force-close-session]=
\n" + " help \n\n"
+ + " : start [] \n" =
+ + " stop