Author: mfortun Date: 2011-04-29 14:20:25 +0200 (Fri, 29 Apr 2011) New Revision: 847 Url: http://nuiton.org/repositories/revision/wikitty/847 Log: * change commit update signature, add a label param Modified: trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/synchro/WikittyPublication.java Modified: trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/synchro/WikittyPublication.java =================================================================== --- trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/synchro/WikittyPublication.java 2011-04-29 10:33:12 UTC (rev 846) +++ trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/synchro/WikittyPublication.java 2011-04-29 12:20:25 UTC (rev 847) @@ -96,6 +96,10 @@ */ static public String LABEL_KEY = "working.label"; + /** + * + */ + /* * Class don't have to be instantiate */ @@ -183,7 +187,8 @@ */ // once on the service origin - applicationConfig.setOption(WIKITTY_SERVICE_INTERLOCUTEUR, target); + applicationConfig.setOption(WIKITTY_SERVICE_INTERLOCUTEUR, new String( + target.replaceAll("\\#.*", ""))); ApplicationConfig temp1 = setUpApplicationConfigServerConnector(uriOrigin); @@ -193,7 +198,8 @@ // store the other uri in the application, if the service is a // wikittypublication file system // it can need it to store wikittyservice property - applicationConfig.setOption(WIKITTY_SERVICE_INTERLOCUTEUR, origin); + applicationConfig.setOption(WIKITTY_SERVICE_INTERLOCUTEUR, new String( + origin.replaceAll("\\#.*", ""))); // once on the service target ApplicationConfig temp2 = setUpApplicationConfigServerConnector(uriTarget); @@ -419,9 +425,9 @@ .criteria(); } - + log.debug(criteriaOnLabels); - + return criteriaOnLabels; } @@ -454,13 +460,13 @@ "org.nuiton.wikitty.services.WikittyServiceCajoClient"); // remove fragment from the uri. - url = url.replaceAll("\\#.*", ""); + url = new String(url.replaceAll("\\#.*", "")); } else if (uri.getScheme().equals("hessian")) { result.setOption(WIKITTY_OPTION_COMPONENT, "org.nuiton.wikitty.services.WikittyServiceHessianClient"); // remove fragment from the uri. - url = url.replaceAll("\\#.*", ""); + url = new String(url.replaceAll("\\#.*", "")); } // set protocol to http, no use finally @@ -479,23 +485,25 @@ } - static public void update(String... uriFileSystem) throws Exception { + static public void update(String label, String... uriFileSystem) + throws Exception { // only difference between update and commit is the param's order // when calling synchronisation method - commitUpdateDelegate(false, uriFileSystem); + commitUpdateDelegate(label, false, uriFileSystem); } - static public void commit(String... uriFileSystem) throws Exception { + static public void commit(String label, String... uriFileSystem) + throws Exception { // only difference between update and commit is the param's order // when calling synchronisation method - commitUpdateDelegate(true, uriFileSystem); + commitUpdateDelegate(label, true, uriFileSystem); } - protected static void commitUpdateDelegate(boolean isCommit, + static protected void commitUpdateDelegate(String label, boolean isCommit, String... uriFileSystem) throws Exception { File currentDir = new File(FileUtil.getCurrentDirectory() @@ -533,7 +541,7 @@ String wikittyServiceInter = ""; String wikittyServiceFileSystem = ""; - String wikittyServiceInterSave = ""; + String labelInitial = ""; PropertiesExtended homeProperty = null; @@ -567,8 +575,9 @@ wikittyServiceFileSystem = "file://" + homePropertyDir.getAbsolutePath() + "#" + labelCurrent; labelInitial = homeProperty.getProperty(LABEL_KEY); - wikittyServiceInterSave = wikittyServiceInter; - wikittyServiceInter += labelCurrent.replaceFirst(labelInitial, ""); + + wikittyServiceInter += "#" + label + + labelCurrent.replaceFirst(labelInitial, ""); break; // if a param is set it mean that the uri of the File system is set @@ -592,9 +601,9 @@ .get(WIKITTY_SERVICE_INTERLOCUTEUR); labelInitial = homeProperty.getProperty(LABEL_KEY); - wikittyServiceInterSave = wikittyServiceInter; - wikittyServiceInter += originUri.getFragment().replaceFirst( - labelInitial, ""); + + wikittyServiceInter += "#" + label + + originUri.getFragment().replaceFirst(labelInitial, ""); break; @@ -623,12 +632,8 @@ } else { synchronisation(wikittyServiceInter, wikittyServiceFileSystem); } - // FIXME mfortun-2011-04-28 find a better way to do this, it's needed - // because of the labels and how construct label for the wikitty service - // interlocuteur - homeProperty.setProperty(WIKITTY_SERVICE_INTERLOCUTEUR, - wikittyServiceInterSave); - homeProperty.store(); + } + }