[Buix-commits] r347 - in trunk/lutinvcs: lutinvcs-api/src/main/java/org/codelutin/vcs lutinvcs-core/src/main/java/org/codelutin/vcs lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs lutinvcs-provider-cvs/src/main/resources/META-INF/services lutinvcs-provider-mock/src/main/java/org/codelutin/vcs lutinvcs-provider-svn/src/main/java/org/codelutin/vcs
Author: tchemit Date: 2008-04-04 21:23:56 +0000 (Fri, 04 Apr 2008) New Revision: 347 Added: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSProvider.java trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSProvider.java trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockProvider.java trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNProvider.java Removed: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandlerProvider.java trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSHandlerProvider.java trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockHandlerProvider.java trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNHandlerProvider.java Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSHandlerFactory.java trunk/lutinvcs/lutinvcs-provider-cvs/src/main/resources/META-INF/services/org.codelutin.vcs.VCSHandlerProvider Log: refactor provider to act as handler and connexion factory Deleted: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandlerProvider.java =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandlerProvider.java 2008-04-04 21:22:58 UTC (rev 346) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandlerProvider.java 2008-04-04 21:23:56 UTC (rev 347) @@ -1,46 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * 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, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs; - -/** - * The contract to be realized to provide vcs communication. - * <p/> - * Atcs as a handler and connexion factory. - * - * @author chemit - * @see VCSHandler - * @see VCSConnexion - */ -public interface VCSHandlerProvider<H extends VCSHandler, C extends VCSConnexion> { - - /** @return the identifier of the vcs provider (eg SVN, CVS, MOCK) */ - String getName(); - - /** - * return a new VCSHandler instance for given config. - * - * @param config svn handler config - * @return the new instance - */ - H newInstance(VCSConfig config); - - /** - * @param mode the mode required - * @param config the config to be used - * @return the new connexion initializd <b>but not opened</b>. - */ - C newConnection(VCSConnexionMode mode, VCSConfig config); - -} Copied: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSProvider.java (from rev 346, trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandlerProvider.java) =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSProvider.java (rev 0) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSProvider.java 2008-04-04 21:23:56 UTC (rev 347) @@ -0,0 +1,46 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * 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, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs; + +/** + * The contract to be realized to provide vcs communication. + * <p/> + * Atcs as a handler and connexion factory. + * + * @author chemit + * @see VCSHandler + * @see VCSConnexion + */ +public interface VCSProvider<H extends VCSHandler, C extends VCSConnexion> { + + /** @return the identifier of the vcs provider (eg SVN, CVS, MOCK) */ + String getName(); + + /** + * return a new VCSHandler instance for given config. + * + * @param config svn handler config + * @return the new instance + */ + H newInstance(VCSConfig config); + + /** + * @param mode the mode required + * @param config the config to be used + * @return the new connexion initializd <b>but not opened</b>. + */ + C newConnection(VCSConnexionMode mode, VCSConfig config); + +} Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSHandlerFactory.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSHandlerFactory.java 2008-04-04 21:22:58 UTC (rev 346) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSHandlerFactory.java 2008-04-04 21:23:56 UTC (rev 347) @@ -49,7 +49,7 @@ private VCSHandler handler; /** providers availables */ - private List<VCSHandlerProvider> providers; + private List<VCSProvider> providers; public static VCSHandlerFactory getInstance() { @@ -91,7 +91,7 @@ VCSHandlerFactory factory = getInstance(); assertConfigIsInit(config); - VCSHandlerProvider<?> provider = factory.getProvider(config.getType().name().toUpperCase()); + VCSProvider<?> provider = factory.getProvider(config.getType().name().toUpperCase()); if (provider == null) { throw new IllegalArgumentException("could not find a provider for type " + config.getType()); } @@ -100,21 +100,21 @@ private VCSHandlerFactory() { long t0 = System.nanoTime(); - providers = new ArrayList<VCSHandlerProvider>(); - for (VCSHandlerProvider provider : ServiceLoader.load(VCSHandlerProvider.class)) { + providers = new ArrayList<VCSProvider>(); + for (VCSProvider provider : ServiceLoader.load(VCSProvider.class)) { providers.add(provider); if (log.isDebugEnabled()) { log.debug("find " + provider); } } log.info("found " + providers.size() + " provider(s) " + providers.toString() + " in " + StringUtil.convertTime(t0, System.nanoTime())); - for (VCSHandlerProvider provider : providers) { + for (VCSProvider provider : providers) { log.info(provider.getName() + " [" + provider + ']'); } } - private VCSHandlerProvider getProvider(String type) { - for (VCSHandlerProvider provider : providers) { + private VCSProvider getProvider(String type) { + for (VCSProvider provider : providers) { if (type.equals(provider.getName().toUpperCase())) { return provider; } Deleted: trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSHandlerProvider.java =================================================================== --- trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSHandlerProvider.java 2008-04-04 21:22:58 UTC (rev 346) +++ trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSHandlerProvider.java 2008-04-04 21:23:56 UTC (rev 347) @@ -1,35 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * 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, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs; - -import org.codelutin.vcs.impl.cvs.CVSHandler; -import org.codelutin.vcs.impl.cvs.CVSHelper; - -/** @author chemit */ -public class CVSHandlerProvider implements VCSHandlerProvider<CVSHandler, CVSConnexion> { - - public String getName() { - return "CVS"; - } - - public CVSHandler newInstance(VCSConfig config) { - CVSHelper.setConfig(config); - return new CVSHandler(config); - } - - public CVSConnexion newConnection(VCSConnexionMode mode, VCSConfig config) { - return null; - } -} \ No newline at end of file Copied: trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSProvider.java (from rev 345, trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSHandlerProvider.java) =================================================================== --- trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSProvider.java (rev 0) +++ trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSProvider.java 2008-04-04 21:23:56 UTC (rev 347) @@ -0,0 +1,35 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * 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, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs; + +import org.codelutin.vcs.impl.cvs.CVSHandler; +import org.codelutin.vcs.impl.cvs.CVSHelper; + +/** @author chemit */ +public class CVSProvider implements VCSProvider<CVSHandler, CVSConnexion> { + + public String getName() { + return "CVS"; + } + + public CVSHandler newInstance(VCSConfig config) { + CVSHelper.setConfig(config); + return new CVSHandler(config); + } + + public CVSConnexion newConnection(VCSConnexionMode mode, VCSConfig config) { + return null; + } +} \ No newline at end of file Modified: trunk/lutinvcs/lutinvcs-provider-cvs/src/main/resources/META-INF/services/org.codelutin.vcs.VCSHandlerProvider =================================================================== --- trunk/lutinvcs/lutinvcs-provider-cvs/src/main/resources/META-INF/services/org.codelutin.vcs.VCSHandlerProvider 2008-04-04 21:22:58 UTC (rev 346) +++ trunk/lutinvcs/lutinvcs-provider-cvs/src/main/resources/META-INF/services/org.codelutin.vcs.VCSHandlerProvider 2008-04-04 21:23:56 UTC (rev 347) @@ -1 +1 @@ -org.codelutin.vcs.CVSHandlerProvider \ No newline at end of file +org.codelutin.vcs.CVSProvider \ No newline at end of file Deleted: trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockHandlerProvider.java =================================================================== --- trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockHandlerProvider.java 2008-04-04 21:22:58 UTC (rev 346) +++ trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockHandlerProvider.java 2008-04-04 21:23:56 UTC (rev 347) @@ -1,33 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * 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, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs; - -import org.codelutin.vcs.impl.mock.MockVCSHandler; - -/** @author chemit */ -public class MockHandlerProvider implements VCSHandlerProvider<MockVCSHandler, MockConnexion> { - - public String getName() { - return "MOCK"; - } - - public MockVCSHandler newInstance(VCSConfig config) { - return new MockVCSHandler(config); - } - - public MockConnexion newConnection(VCSConnexionMode mode, VCSConfig config) { - return null; - } -} \ No newline at end of file Copied: trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockProvider.java (from rev 345, trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockHandlerProvider.java) =================================================================== --- trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockProvider.java (rev 0) +++ trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockProvider.java 2008-04-04 21:23:56 UTC (rev 347) @@ -0,0 +1,33 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * 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, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs; + +import org.codelutin.vcs.impl.mock.MockVCSHandler; + +/** @author chemit */ +public class MockProvider implements VCSProvider<MockVCSHandler, MockConnexion> { + + public String getName() { + return "MOCK"; + } + + public MockVCSHandler newInstance(VCSConfig config) { + return new MockVCSHandler(config); + } + + public MockConnexion newConnection(VCSConnexionMode mode, VCSConfig config) { + return null; + } +} \ No newline at end of file Deleted: trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNHandlerProvider.java =================================================================== --- trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNHandlerProvider.java 2008-04-04 21:22:58 UTC (rev 346) +++ trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNHandlerProvider.java 2008-04-04 21:23:56 UTC (rev 347) @@ -1,33 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * 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, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs; - -import org.codelutin.vcs.impl.svn.SVNHandler; -import org.codelutin.vcs.util.AbstractVCSConnexion; - -/** @author chemit */ -public class SVNHandlerProvider implements VCSHandlerProvider<SVNHandler, AbstractVCSConnexion> { - public String getName() { - return "SVN"; - } - - public SVNHandler newInstance(VCSConfig config) { - return new SVNHandler(config); - } - - public AbstractVCSConnexion newConnection(VCSConnexionMode mode, VCSConfig config) { - return null; - } -} Copied: trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNProvider.java (from rev 345, trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNHandlerProvider.java) =================================================================== --- trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNProvider.java (rev 0) +++ trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNProvider.java 2008-04-04 21:23:56 UTC (rev 347) @@ -0,0 +1,33 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * 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, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs; + +import org.codelutin.vcs.impl.svn.SVNHandler; +import org.codelutin.vcs.util.AbstractVCSConnexion; + +/** @author chemit */ +public class SVNProvider implements VCSProvider<SVNHandler, AbstractVCSConnexion> { + public String getName() { + return "SVN"; + } + + public SVNHandler newInstance(VCSConfig config) { + return new SVNHandler(config); + } + + public AbstractVCSConnexion newConnection(VCSConnexionMode mode, VCSConfig config) { + return null; + } +}
participants (1)
-
tchemit@users.labs.libre-entreprise.org