From do-not-reply at jboss.org Mon Nov 29 02:27:59 2010 Content-Type: multipart/mixed; boundary="===============1700117539666542259==" 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: r3575 - in jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules: jcr and 1 other directory. Date: Mon, 29 Nov 2010 02:27:59 -0500 Message-ID: <201011290727.oAT7Rxun004814@svn01.web.mwc.hst.phx2.redhat.com> --===============1700117539666542259== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: sergiykarpenko Date: 2010-11-29 02:27:57 -0500 (Mon, 29 Nov 2010) New Revision: 3575 Added: jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/= modules/jcr/repository-creation-service.xml Modified: jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/= modules/jcr.xml Log: EXOJCR-929: RepositoryCreationService documentation added Added: jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en= -US/modules/jcr/repository-creation-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/repository-creation-service.xml (rev 0) +++ jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US= /modules/jcr/repository-creation-service.xml 2010-11-29 07:27:57 UTC (rev 3= 575) @@ -0,0 +1,209 @@ + + + + + + RepositoryCreationService + +
+ Intro + + RepositoryCreationService is the service for creation repositori= es + in runtime. The service can be used in standalone or cluster + environment. +
+ +
+ Dependencies + + RepositoryConfigurationService depends to next components: + + + + DBCreator - + DBCreator used to create new database for each unbinded datasource. + + + + + BackupManager - + BackupManager used to created repository from backup. + + + + RPCService - RPCS= ervice + used for communication between cluster-nodes + + + RPCService may not be configured - in this case, + RepositoryService will work as standalone service. + + + +
+ +
+ How it works + + + + User executes reserveRepositoryName(String repositoryName) - + client-node calls coordinator-node to reserve repositoryName. If t= his + name is already reserved or repository with this name exist, + client-node will fetch RepositoryCreationException. If not Client = will + get token string. + + + + than user executes createRepository(String backupId, + RepositoryEntry rEntry, String token). Coordinator-node checks the + token, and creates Repository. + + + + whan repository become created - user-node broadcast messag= e to + all clusterNodes with RepositoryEntry, so each cluster node starts= new + Repository. + + + + There is two ways to create repositry: make it in single step - = just + call createRepository(String backupId, RepositoryEntry); or reserve + repositoryName at first (reserveRepositoryName(String repositoryName)), + than create reserved repository (createRepository(String backupId, + RepositoryEntry rEntry, String token)). +
+ +
+ Configuration + + RepositoryCreationService configuration + + <component> + <key>org.exoplatform.services.jcr.ext.backup.BackupManager</ke= y> + <type>org.exoplatform.services.jcr.ext.backup.impl.BackupManagerI= mpl</type> + <init-params> + <properties-param> + <name>backup-properties</name> + <property name=3D"default-incremental-job-period" value=3D"360= 0" /><!-- set default incremental periond =3D 60 minutes --> + <property name=3D"full-backup-type" value=3D"org.exoplatform.s= ervices.jcr.ext.backup.impl.fs.FullBackupJob" /> + <property name=3D"incremental-backup-type" value=3D"org.exopla= tform.services.jcr.ext.backup.impl.fs.IncrementalBackupJob" /> + <property name=3D"backup-dir" value=3D"target/backup" /> + </properties-param> + </init-params> +</component> + +<component> + <key>org.exoplatform.services.database.creator.DBCreator</key&= gt; + <type>org.exoplatform.services.database.creator.DBCreator</typ= e> + <init-params> + <properties-param> + <name>db-connection</name> + <description>database connection properties</description= > + <property name=3D"driverClassName" value=3D"org.hsqldb.jdbcDri= ver" /> + <property name=3D"url" value=3D"jdbc:hsqldb:file:target/temp/d= ata/" /> + <property name=3D"username" value=3D"sa" /> + <property name=3D"password" value=3D"" /> + </properties-param> + <properties-param> + <name>db-creation</name> + <description>database creation properties</description&g= t; + <property name=3D"scriptPath" value=3D"src/test/resources/test= .sql" /> + <property name=3D"username" value=3D"sa" /> + <property name=3D"password" value=3D"" /> + </properties-param> + </init-params> +</component> + +<component> + <key>org.exoplatform.services.rpc.RPCService</key> + <type>org.exoplatform.services.rpc.impl.RPCServiceImpl</type&g= t; + <init-params> + <value-param> + <name>jgroups-configuration</name> + <value>jar:/conf/standalone/udp-mux.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> = + +<component> + <key>org.exoplatform.services.jcr.ext.repository.creation.Reposit= oryCreationService</key> + <type> + org.exoplatform.services.jcr.ext.repository.creation.RepositoryCreat= ionServiceImpl + </type> +</component> +
+ +
+ Repsitory Interface + + public interface RepositoryCreationService +{ + /** + * Reserves, validates and creates repository in a simplified form. = + * = + * @param rEntry - repository Entry - note that datasource must not exi= st. + * @param backupId - backup id + * @throws RepositoryConfigurationException + * if some exception occurred during repository creation or re= pository name is absent in reserved list + * @throws RepositoryCreationServiceException + * if some exception occurred during repository creation or re= pository name is absent in reserved list + */ + void createRepository(String backupId, RepositoryEntry rEntry) throws R= epositoryConfigurationException, + RepositoryCreationException; + + /** + * Reserve repository name to prevent repository creation with same nam= e from other place in same time + * via this service. + * = + * @param repositoryName - repositoryName + * @return repository token. Anyone obtaining a token can later create = a repository of reserved name. + * @throws RepositoryCreationServiceException if can't reserve name + */ + String reserveRepositoryName(String repositoryName) throws RepositoryCr= eationException; + + /** + * Creates repository, using token of already reserved repository name= . Good for cases, when repository creation should be delayed or = + * made asynchronously in dedicated thread. = + * = + * @param rEntry - repository entry - note, that datasource must not ex= ist + * @param backupId - backup id + * @param rToken - token + * @throws RepositoryConfigurationException + * if some exception occurred during repository creation or re= pository name is absent in reserved list + * @throws RepositoryCreationServiceException + * if some exception occurred during repository creation or re= pository name is absent in reserved list + */ + void createRepository(String backupId, RepositoryEntry rEntry, String r= Token) + throws RepositoryConfigurationException, RepositoryCreationException; +} +
+ +
+ Conclusions and restrictions + + + + Each datasource in RepositoryEntry of new Repository must ha= ve + unbinded datasources. Thats mean, such datasource must have not + databases behind them. This restriction exists to avoid corruption= of + existing repositories data. + + + + RPCService is optional component, but without it, + RepositoryCreatorService can not communicate with other cluster-no= des + and works as standalone. + + +
+
Modified: jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook= /en-US/modules/jcr.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.xml 2010-11-26 15:02:32 UTC (rev 3574) +++ jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US= /modules/jcr.xml 2010-11-29 07:27:57 UTC (rev 3575) @@ -89,7 +89,11 @@ = + = + + =