Nuiton-utils-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
April 2008
- 2 participants
- 17 discussions
[Lutinutil-commits] r796 - trunk/lutinutil/src/java/org/codelutin/util
by thimel@users.labs.libre-entreprise.org 28 Apr '08
by thimel@users.labs.libre-entreprise.org 28 Apr '08
28 Apr '08
Author: thimel
Date: 2008-04-28 13:47:10 +0000 (Mon, 28 Apr 2008)
New Revision: 796
Modified:
trunk/lutinutil/src/java/org/codelutin/util/Resource.java
Log:
Added getURLOrNull when no ressource found by the normal way in getConfigProperties
Modified: trunk/lutinutil/src/java/org/codelutin/util/Resource.java
===================================================================
--- trunk/lutinutil/src/java/org/codelutin/util/Resource.java 2008-04-27 12:50:56 UTC (rev 795)
+++ trunk/lutinutil/src/java/org/codelutin/util/Resource.java 2008-04-28 13:47:10 UTC (rev 796)
@@ -178,6 +178,9 @@
if (inClasspath == null) {
inClasspath = Resource.class.getResource(filename);
}
+ if (inClasspath == null) {
+ inClasspath = getURLOrNull(filename);
+ }
if(inClasspath != null){
log.info("Chargement du fichier de config: " + inClasspath);
result.load(inClasspath.openStream());
1
0
[Lutinutil-commits] r795 - branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
27 Apr '08
Author: tchemit
Date: 2008-04-27 12:50:56 +0000 (Sun, 27 Apr 2008)
New Revision: 795
Modified:
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/SimpleConfig.java
Log:
copy all properties, not only non null, introduce universe of config properties
Modified: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/SimpleConfig.java
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/SimpleConfig.java 2008-04-27 12:40:27 UTC (rev 794)
+++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/SimpleConfig.java 2008-04-27 12:50:56 UTC (rev 795)
@@ -20,6 +20,8 @@
import java.lang.reflect.InvocationTargetException;
import java.util.EnumMap;
+import java.util.EnumSet;
+import java.util.Map;
/**
* simple config implementation based on a Enum to obtain properties
@@ -28,12 +30,15 @@
*/
public class SimpleConfig<E extends Enum<E>> implements Config<E> {
- static protected final Log log = LogFactory.getLog(SimpleConfig.class);
+ static protected final Log log = LogFactory.getLog(Config.class);
- protected java.util.EnumMap<E, Object> properties;
+ protected EnumMap<E, Object> properties;
+ protected final EnumSet<E> universe;
+
public SimpleConfig(Class<E> klass) {
- this.properties = new java.util.EnumMap<E, Object>(klass);
+ this.properties = new EnumMap<E, Object>(klass);
+ this.universe = java.util.EnumSet.allOf(klass);
}
public SimpleConfig(Class<E> klass, EnumMap<E, Object> properties) {
@@ -41,12 +46,12 @@
setProperties(properties);
}
- public java.util.EnumMap<E, Object> getProperties() {
+ public EnumMap<E, Object> getProperties() {
return properties.clone();
}
- public void setProperties(java.util.EnumMap<E, Object> properties) {
- for (java.util.Map.Entry<E, Object> entry : properties.entrySet()) {
+ public void setProperties(EnumMap<E, Object> properties) {
+ for (Map.Entry<E, Object> entry : properties.entrySet()) {
setProperty(entry.getKey(), entry.getValue());
}
}
@@ -61,36 +66,35 @@
}
public void copyFrom(Object src) {
- for (java.util.Map.Entry<E, Object> entry : properties.entrySet()) {
- E key = entry.getKey();
+ for (E key : universe) {
+ Object value = null;
try {
- Object value = BeanUtils.getProperty(src, key.name());
+ value = BeanUtils.getProperty(src, key.name());
setProperty(key, value);
} catch (IllegalAccessException e) {
//TODO
- log.warn("could not retreave property " + key + " on object " + src, e);
+ log.warn("could not retreave property <" + key + ":" + value + "> on object " + src, e);
} catch (InvocationTargetException e) {
//TODO
- log.warn("could not retreave property " + key + " on object " + src, e);
+ log.warn("could not retreave property <" + key + ":" + value + "> on object " + src, e);
} catch (NoSuchMethodException e) {
//TODO
- log.warn("could not retreave property " + key + " on object " + src, e);
+ log.warn("could not retreave property <" + key + ":" + value + "> on object " + src, e);
}
-
}
}
public void copyTo(Object dst) {
- for (java.util.Map.Entry<E, Object> entry : properties.entrySet()) {
- Object value = entry.getValue();
+ for (E key : universe) {
+ Object value = properties.get(key);
try {
- BeanUtils.setProperty(dst, entry.getKey().name(), value);
+ BeanUtils.setProperty(dst, key.name(), value);
} catch (IllegalAccessException e) {
//TODO
- log.warn("could not set property " + entry.getKey() + " to object " + dst, e);
+ log.warn("could not set property <" + key + ":" + value + "> to object " + dst, e);
} catch (InvocationTargetException e) {
//TODO
- log.warn("could not set property " + entry.getKey() + " to object " + dst, e);
+ log.warn("could not set property <" + key + ":" + value + "> to object " + dst, e);
}
}
}
@@ -101,7 +105,7 @@
if (properties.isEmpty()) {
sb.append(" empty");
} else {
- for (java.util.Map.Entry<E, Object> entry : properties.entrySet()) {
+ for (Map.Entry<E, Object> entry : properties.entrySet()) {
sb.append(", ").append(entry.getKey()).append(':').append(entry.getValue());
}
}
1
0
[Lutinutil-commits] r794 - branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
27 Apr '08
Author: tchemit
Date: 2008-04-27 12:40:27 +0000 (Sun, 27 Apr 2008)
New Revision: 794
Modified:
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/Config.java
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/SimpleConfig.java
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/SimpleIdentityConfig.java
Log:
add copyFrom and copyTo method to bind config to another object via introspection.
add constructor
Modified: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/Config.java
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/Config.java 2008-04-27 12:00:51 UTC (rev 793)
+++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/Config.java 2008-04-27 12:40:27 UTC (rev 794)
@@ -29,4 +29,8 @@
void setProperty(E key, Object value);
+ void copyFrom(Object src);
+
+ void copyTo(Object dst);
+
}
\ No newline at end of file
Modified: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/SimpleConfig.java
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/SimpleConfig.java 2008-04-27 12:00:51 UTC (rev 793)
+++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/SimpleConfig.java 2008-04-27 12:40:27 UTC (rev 794)
@@ -14,8 +14,13 @@
*/
package org.codelutin.util.config;
-import org.codelutin.util.config.Config;
+import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import java.lang.reflect.InvocationTargetException;
+import java.util.EnumMap;
+
/**
* simple config implementation based on a Enum to obtain properties
*
@@ -23,12 +28,19 @@
*/
public class SimpleConfig<E extends Enum<E>> implements Config<E> {
+ static protected final Log log = LogFactory.getLog(SimpleConfig.class);
+
protected java.util.EnumMap<E, Object> properties;
public SimpleConfig(Class<E> klass) {
this.properties = new java.util.EnumMap<E, Object>(klass);
}
+ public SimpleConfig(Class<E> klass, EnumMap<E, Object> properties) {
+ this(klass);
+ setProperties(properties);
+ }
+
public java.util.EnumMap<E, Object> getProperties() {
return properties.clone();
}
@@ -41,12 +53,48 @@
public void setProperty(E key, Object value) {
if (value == null && properties.containsKey(key)) {
+ // never keep a reference on a null value property
properties.remove(key);
} else {
properties.put(key, value);
}
}
+ public void copyFrom(Object src) {
+ for (java.util.Map.Entry<E, Object> entry : properties.entrySet()) {
+ E key = entry.getKey();
+ try {
+ Object value = BeanUtils.getProperty(src, key.name());
+ setProperty(key, value);
+ } catch (IllegalAccessException e) {
+ //TODO
+ log.warn("could not retreave property " + key + " on object " + src, e);
+ } catch (InvocationTargetException e) {
+ //TODO
+ log.warn("could not retreave property " + key + " on object " + src, e);
+ } catch (NoSuchMethodException e) {
+ //TODO
+ log.warn("could not retreave property " + key + " on object " + src, e);
+ }
+
+ }
+ }
+
+ public void copyTo(Object dst) {
+ for (java.util.Map.Entry<E, Object> entry : properties.entrySet()) {
+ Object value = entry.getValue();
+ try {
+ BeanUtils.setProperty(dst, entry.getKey().name(), value);
+ } catch (IllegalAccessException e) {
+ //TODO
+ log.warn("could not set property " + entry.getKey() + " to object " + dst, e);
+ } catch (InvocationTargetException e) {
+ //TODO
+ log.warn("could not set property " + entry.getKey() + " to object " + dst, e);
+ }
+ }
+ }
+
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
Modified: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/SimpleIdentityConfig.java
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/SimpleIdentityConfig.java 2008-04-27 12:00:51 UTC (rev 793)
+++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/SimpleIdentityConfig.java 2008-04-27 12:40:27 UTC (rev 794)
@@ -18,6 +18,8 @@
import static org.codelutin.util.config.IdentityConfigProperty.firstName;
import static org.codelutin.util.config.IdentityConfigProperty.lastName;
+import java.util.EnumMap;
+
/** @author chemit */
public class SimpleIdentityConfig extends SimpleConfig<IdentityConfigProperty> implements IdentityConfig {
@@ -32,6 +34,10 @@
setEmail(email);
}
+ public SimpleIdentityConfig(EnumMap<IdentityConfigProperty, Object> properties) {
+ super(IdentityConfigProperty.class, properties);
+ }
+
public String getFirstName() {
return (String) properties.get(firstName);
}
1
0
[Lutinutil-commits] r793 - in branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util: . config
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
27 Apr '08
Author: tchemit
Date: 2008-04-27 12:00:51 +0000 (Sun, 27 Apr 2008)
New Revision: 793
Added:
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/Config.java
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/IdentityConfig.java
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/IdentityConfigProperty.java
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/SimpleConfig.java
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/SimpleIdentityConfig.java
Log:
add config based on an Enum of properties
add identity config and his implentation
Added: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/Config.java
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/Config.java (rev 0)
+++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/Config.java 2008-04-27 12:00:51 UTC (rev 793)
@@ -0,0 +1,32 @@
+/**
+ * # #% 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.util.config;
+
+import java.util.EnumMap;
+
+/**
+ * config contract based on a Enum to obtain properties
+ *
+ * @author chemit
+ */
+public interface Config<E extends Enum<E>> {
+
+ EnumMap<E, Object> getProperties();
+
+ void setProperties(EnumMap<E, Object> properties);
+
+ void setProperty(E key, Object value);
+
+}
\ No newline at end of file
Added: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/IdentityConfig.java
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/IdentityConfig.java (rev 0)
+++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/IdentityConfig.java 2008-04-27 12:00:51 UTC (rev 793)
@@ -0,0 +1,37 @@
+/**
+ * # #% 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.util.config;
+
+
+/**
+ * Definition of an identity
+ *
+ * @author chemit
+ */
+public interface IdentityConfig extends Config<IdentityConfigProperty> {
+
+ String getFirstName();
+
+ String getLastName();
+
+ String getEmail();
+
+ void setFirstName(String firstName);
+
+ void setLastName(String lastName);
+
+ void setEmail(String email);
+
+}
\ No newline at end of file
Added: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/IdentityConfigProperty.java
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/IdentityConfigProperty.java (rev 0)
+++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/IdentityConfigProperty.java 2008-04-27 12:00:51 UTC (rev 793)
@@ -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.util.config;
+
+/**
+ * Enumaration of properties to be used in a {@link org.codelutin.util.config.IdentityConfig}
+ *
+ * @author chemit
+ * @see IdentityConfig
+ */
+public enum IdentityConfigProperty {
+
+ /** property <code>name</code>, first name of user */
+ firstName,
+
+ /** property <code>type</code>, lastname of user */
+ lastName,
+
+ /** property <code>email</code>, email of user */
+ email
+
+ //TODO add locale + encoding
+}
\ No newline at end of file
Added: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/SimpleConfig.java
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/SimpleConfig.java (rev 0)
+++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/SimpleConfig.java 2008-04-27 12:00:51 UTC (rev 793)
@@ -0,0 +1,62 @@
+/**
+ * # #% 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.util.config;
+
+import org.codelutin.util.config.Config;
+
+/**
+ * simple config implementation based on a Enum to obtain properties
+ *
+ * @author chemit
+ */
+public class SimpleConfig<E extends Enum<E>> implements Config<E> {
+
+ protected java.util.EnumMap<E, Object> properties;
+
+ public SimpleConfig(Class<E> klass) {
+ this.properties = new java.util.EnumMap<E, Object>(klass);
+ }
+
+ public java.util.EnumMap<E, Object> getProperties() {
+ return properties.clone();
+ }
+
+ public void setProperties(java.util.EnumMap<E, Object> properties) {
+ for (java.util.Map.Entry<E, Object> entry : properties.entrySet()) {
+ setProperty(entry.getKey(), entry.getValue());
+ }
+ }
+
+ public void setProperty(E key, Object value) {
+ if (value == null && properties.containsKey(key)) {
+ properties.remove(key);
+ } else {
+ properties.put(key, value);
+ }
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ if (properties.isEmpty()) {
+ sb.append(" empty");
+ } else {
+ for (java.util.Map.Entry<E, Object> entry : properties.entrySet()) {
+ sb.append(", ").append(entry.getKey()).append(':').append(entry.getValue());
+ }
+ }
+ return super.toString() + '<' + sb.toString().substring(2) + '>';
+ }
+}
Added: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/SimpleIdentityConfig.java
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/SimpleIdentityConfig.java (rev 0)
+++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/SimpleIdentityConfig.java 2008-04-27 12:00:51 UTC (rev 793)
@@ -0,0 +1,59 @@
+/**
+ * # #% 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.util.config;
+
+import static org.codelutin.util.config.IdentityConfigProperty.email;
+import static org.codelutin.util.config.IdentityConfigProperty.firstName;
+import static org.codelutin.util.config.IdentityConfigProperty.lastName;
+
+/** @author chemit */
+public class SimpleIdentityConfig extends SimpleConfig<IdentityConfigProperty> implements IdentityConfig {
+
+ public SimpleIdentityConfig() {
+ super(IdentityConfigProperty.class);
+ }
+
+ public SimpleIdentityConfig(String firstName, String lastName, String email) {
+ this();
+ setFirstName(firstName);
+ setLastName(lastName);
+ setEmail(email);
+ }
+
+ public String getFirstName() {
+ return (String) properties.get(firstName);
+ }
+
+ public String getLastName() {
+ return (String) properties.get(lastName);
+ }
+
+ public String getEmail() {
+ return (String) properties.get(email);
+ }
+
+ public void setFirstName(String newFirstName) {
+ setProperty(firstName, newFirstName);
+ }
+
+ public void setLastName(String newLastName) {
+ setProperty(lastName, newLastName);
+ }
+
+ public void setEmail(String newEmail) {
+ setProperty(email, newEmail);
+ }
+
+}
1
0
[Lutinutil-commits] r792 - branches/lutinutil-sans-vcs/lutinutil
by tchemit@users.labs.libre-entreprise.org 18 Apr '08
by tchemit@users.labs.libre-entreprise.org 18 Apr '08
18 Apr '08
Author: tchemit
Date: 2008-04-18 17:19:08 +0000 (Fri, 18 Apr 2008)
New Revision: 792
Modified:
branches/lutinutil-sans-vcs/lutinutil/
Log:
svn ignore
Property changes on: branches/lutinutil-sans-vcs/lutinutil
___________________________________________________________________
Name: svn:ignore
- target
velocity.log
maven.log
.eclipse
.classpath
lutinutil.iml
lutinutil.ipr
+ target
velocity.log
maven.log
.eclipse
.classpath
lutinutil.iml
lutinutil.ipr
lutinutil.iws
1
0
Author: tchemit
Date: 2008-04-18 12:10:42 +0000 (Fri, 18 Apr 2008)
New Revision: 791
Added:
trunk/lutinvcs/
Log:
lutinvcs in lutinutil project
1
0
[Lutinutil-commits] r790 - in branches/lutinutil-sans-vcs/lutinutil/src: java/org/codelutin resources/i18n
by tchemit@users.labs.libre-entreprise.org 15 Apr '08
by tchemit@users.labs.libre-entreprise.org 15 Apr '08
15 Apr '08
Author: tchemit
Date: 2008-04-15 09:10:36 +0000 (Tue, 15 Apr 2008)
New Revision: 790
Removed:
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/
Modified:
branches/lutinutil-sans-vcs/lutinutil/src/resources/i18n/lutinutil-en_GB.properties
branches/lutinutil-sans-vcs/lutinutil/src/resources/i18n/lutinutil-fr_FR.properties
Log:
suppresion vcs de lutinutil (+ passage en 0.31-SNAPSHOT version temporaire...)
Modified: branches/lutinutil-sans-vcs/lutinutil/src/resources/i18n/lutinutil-en_GB.properties
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/src/resources/i18n/lutinutil-en_GB.properties 2008-04-15 09:09:28 UTC (rev 789)
+++ branches/lutinutil-sans-vcs/lutinutil/src/resources/i18n/lutinutil-en_GB.properties 2008-04-15 09:10:36 UTC (rev 790)
@@ -1,24 +1,11 @@
hello\ you\ \!=hello you \!
-isisfish.common.file=File
lutin.error.convertor.noValue=No value specified for converter {0}
lutin.error.no.convertor=no convertor found for type {1} and objet ''{0}''
lutin.error.url.convertor=a problem occurs while converting value ''{0}}'' with url convertor {1} for reason {2}
-lutinutil.common.action=Action
-lutinutil.common.file=File
-lutinutil.common.logDiff=show diff
-lutinutil.common.module=Module
-lutinutil.common.rev=Revision
-lutinutil.common.select=Select
-lutinutil.error.checkout.dir=Can''t checkout dir {0}
-lutinutil.error.fieldmodel.already.registred=FieldAccess [{0}] is already registred
-lutinutil.error.fieldmodel.not.registred=could not found a matching entry in cache for [{0}]
-lutinutil.error.fieldmodel.unmatchin.options=you can not defined a such model with no the same number of optionClass and optionNames
lutinutil.error.i18n.unformated.message=Message can't be formatted\: ''{0}'' with arguments {1}
lutinutil.error.i18n.unfound.country=could not find country from ''{0}'', use default country ''{1}''
lutinutil.error.i18n.unfound.language=could not find language from ''{0}'', use default language ''{1}''
lutinutil.error.i18n.untranslated.message=Message can't be translated\: ''{0}''
-lutinutil.error.init.config=config is not init, you should invoke on the config validate(true) method to validate it and finish his init {0}
-lutinutil.error.init.no.config=should invoke {0}\#init(VCSType,Properties) before required instance.
lutinutil.error.unfound.month=could not found month from ''{0}'', use default month ''{1}''
lutinutil.fileCompletion.cancel=.. to cancel or return to parent directory
lutinutil.fileCompletion.enter=Enter to display file list, or to complete path
@@ -36,20 +23,3 @@
lutinutil.month.november=november
lutinutil.month.october=october
lutinutil.month.september=september
-lutinutil.vcs.action.add=add
-lutinutil.vcs.action.changeLog=changeLog
-lutinutil.vcs.action.checkout=checkout
-lutinutil.vcs.action.commit=commit
-lutinutil.vcs.action.delete=delete
-lutinutil.vcs.action.diff=diff
-lutinutil.vcs.action.overwriteAndUpdate=overwriteAndUpdate
-lutinutil.vcs.action.revert=revert
-lutinutil.vcs.action.update=update
-lutinutil.vcs.state.missing=missing
-lutinutil.vcs.state.modified=modified
-lutinutil.vcs.state.outofdate=outofdate
-lutinutil.vcs.state.outofdateAndModified=outofdateAndModified
-lutinutil.vcs.state.unknown=unknown
-lutinutil.vcs.state.unversionned=unversionned
-lutinutil.vcs.state.unversionnedOrMissing=unversionnedOrMissing
-lutinutil.vcs.state.uptodate=uptodate
Modified: branches/lutinutil-sans-vcs/lutinutil/src/resources/i18n/lutinutil-fr_FR.properties
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/src/resources/i18n/lutinutil-fr_FR.properties 2008-04-15 09:09:28 UTC (rev 789)
+++ branches/lutinutil-sans-vcs/lutinutil/src/resources/i18n/lutinutil-fr_FR.properties 2008-04-15 09:10:36 UTC (rev 790)
@@ -1,24 +1,11 @@
hello\ you\ \!=Salut toi\!
-isisfish.common.file=Fichier
lutin.error.convertor.noValue=Aucune valeur \u00E0 convertir pour le convertisseur {0}
lutin.error.no.convertor=Aucun convertisseur trouv\u00E9 pour le type {1} et l''objet ''{0}''
lutin.error.url.convertor=un probl\u00E8me est apparu lors de la convertion en url de ''{0}}'' avec le convertisseur {1} pour la raison suivante \: {2}
-lutinutil.common.action=Action
-lutinutil.common.file=Fichier
-lutinutil.common.logDiff=LogDiff
-lutinutil.common.module=Module
-lutinutil.common.rev=R\u00E9vision
-lutinutil.common.select=S\u00E9lectionner
-lutinutil.error.checkout.dir=Can''t checkout dir {0}
-lutinutil.error.fieldmodel.already.registred=FieldAccess [{0}] is already registred
-lutinutil.error.fieldmodel.not.registred=could not found a matching entry in cache for [{0}]
-lutinutil.error.fieldmodel.unmatchin.options=
lutinutil.error.i18n.unformated.message=Le message suivant n''a pas pu \u00EAtre format\u00E9 \: ''{0}'' avec les arguments {1}
lutinutil.error.i18n.unfound.country=n''a pas pu trouver le pays \u00E0 partir de ''{0}'', utilise le pays par d\u00E9faut ''{1}''
lutinutil.error.i18n.unfound.language=n''a pas pu trouver la langue \u00E0 partir de ''{0}'', utilise la langue par d\u00E9faut ''{1}''
lutinutil.error.i18n.untranslated.message=Le message suivant n''a pas pu \u00EAtre traduit \: ''{0}''
-lutinutil.error.init.config=config is not init, you should invoke on the config validate(true) method to validate it and finish his init {0}
-lutinutil.error.init.no.config=should invoke {0}\#init(VCSType,Properties) before required instance.
lutinutil.error.unfound.month=n''a pas pu trouv\u00E9 le mois \u00E0 partir de ''{0}'', utilise le mois par d\u00E9faut ''{1}''
lutinutil.fileCompletion.cancel=.. pour annuler ou pour revenir au repertoire pr\u00E9c\u00E9dent
lutinutil.fileCompletion.enter=Entrer pour afficher la liste des fichiers, ou pour compl\u00E9ter le chemin
@@ -36,20 +23,3 @@
lutinutil.month.november=novembre
lutinutil.month.october=octobre
lutinutil.month.september=septembre
-lutinutil.vcs.action.add=Add
-lutinutil.vcs.action.changeLog=journal des changements
-lutinutil.vcs.action.checkout=R\u00E9cup\u00E9rer
-lutinutil.vcs.action.commit=Commiter
-lutinutil.vcs.action.delete=Supprimer
-lutinutil.vcs.action.diff=voir les diff\u00E9rences
-lutinutil.vcs.action.overwriteAndUpdate=Update
-lutinutil.vcs.action.revert=Rollback
-lutinutil.vcs.action.update=Update
-lutinutil.vcs.state.missing=fichier non pr\u00E9sent localement
-lutinutil.vcs.state.modified=fichier modifi\u00E9
-lutinutil.vcs.state.outofdate=fichier obsol\u00E8te
-lutinutil.vcs.state.outofdateAndModified=fichier modifi\u00E9 et obsol\u00E8te
-lutinutil.vcs.state.unknown=fichier d'\u00E9tat inconnu
-lutinutil.vcs.state.unversionned=fichier non versionn\u00E9
-lutinutil.vcs.state.unversionnedOrMissing=fichier non versionn\u00E9 ou non pr\u00E9sent localement
-lutinutil.vcs.state.uptodate=fichier \u00E0 jour
1
0
[Lutinutil-commits] r789 - in branches/lutinutil-sans-vcs/lutinutil: . src/java/org/codelutin/vcs
by tchemit@users.labs.libre-entreprise.org 15 Apr '08
by tchemit@users.labs.libre-entreprise.org 15 Apr '08
15 Apr '08
Author: tchemit
Date: 2008-04-15 09:09:28 +0000 (Tue, 15 Apr 2008)
New Revision: 789
Removed:
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/AbstractVCSHandler.java
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/ConnectionState.java
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSAction.java
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSConfig.java
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSException.java
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSFileState.java
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSFileStateManager.java
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSHandler.java
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSHandlerFactory.java
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSHelper.java
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSRepositoryState.java
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSRuntimeException.java
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSState.java
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSStatus.java
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSType.java
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSTypeRepo.java
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSUIAction.java
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/package.html
branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/ui/
Modified:
branches/lutinutil-sans-vcs/lutinutil/pom.xml
Log:
suppresion vcs de lutinutil (+ passage en 0.31-SNAPSHOT version temporaire...)
Modified: branches/lutinutil-sans-vcs/lutinutil/pom.xml
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/pom.xml 2008-04-15 09:06:30 UTC (rev 788)
+++ branches/lutinutil-sans-vcs/lutinutil/pom.xml 2008-04-15 09:09:28 UTC (rev 789)
@@ -20,7 +20,7 @@
<packaging>jar</packaging>
<!--Version-->
- <version>0.29-SNAPSHOT</version>
+ <version>0.31-SNAPSHOT</version>
<!--Description-->
<description>
Deleted: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/AbstractVCSHandler.java
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/AbstractVCSHandler.java 2008-04-15 09:06:30 UTC (rev 788)
+++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/AbstractVCSHandler.java 2008-04-15 09:09:28 UTC (rev 789)
@@ -1,134 +0,0 @@
-/* *##%
-* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin,
-* Benjamin Poussin, 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.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.codelutin.util.FileUtil;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FilenameFilter;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * abstract VCSHandler base with usefull methods that does not need vcs specific code.
- *
- * @author chemit
- */
-public abstract class AbstractVCSHandler implements VCSHandler {
-
- /** to use log facility, just put in your code: log.info(\"...\"); */
- static protected final Log log = LogFactory.getLog(AbstractVCSHandler.class);
-
- /**
- * FilenameFilter to detect all files in a vcs working copy all files and directories that must be handled by vcs
- *
- * @see org.codelutin.vcs.VCSHandler#getVersionnableFilenameFilter()
- */
- protected final FilenameFilter versionnableFilenameFilter;
- protected final FileFilter versionnableFileFilter;
- protected final String confLocalDirName;
- protected final String confLocalEntriesFilename;
- protected final VCSConfig config;
-
- protected AbstractVCSHandler(VCSConfig config, final String vCSConfLocalDirName, String vCSConfLocalEntriesFilename) {
- this.config = config;
- this.confLocalDirName = vCSConfLocalDirName;
- this.confLocalEntriesFilename = vCSConfLocalEntriesFilename;
- this.versionnableFilenameFilter = new FilenameFilter() {
- public boolean accept(File dir, String name) {
- return !vCSConfLocalDirName.equals(name) && !"CVS".equals(name);
- }
- };
- this.versionnableFileFilter = new FileFilter() {
- public boolean accept(File dir) {
- return dir.isFile() || (!vCSConfLocalDirName.equals(dir.getName()) && !"CVS".equals(dir.getName()));
- }
- };
- }
-
- public VCSConfig getConfig() {
- return config;
- }
-
- public File getLocalDatabasePath() {
- return config.getLocalDatabasePath();
- }
-
- public void deleteWorkingCopy() {
- if (getLocalDatabasePath().exists()) {
- FileUtil.deleteRecursively(getLocalDatabasePath());
- getLocalDatabasePath().delete();
- }
- }
-
- public FilenameFilter getVersionnableFilenameFilter() {
- return versionnableFilenameFilter;
- }
-
- public FileFilter getVersionnableFileFilter() {
- return versionnableFileFilter;
- }
-
- public String getConfLocalDirname() {
- return confLocalDirName;
- }
-
- public String getConfLocalEntriesFilename() {
- return confLocalEntriesFilename;
- }
-
- public boolean isVersionnableFile(File file) {
- assertFileExists(file, "file is empty or non existant");
- return !confLocalDirName.equalsIgnoreCase(file.getName());
- }
-
- public List<String> getLocalStorageNames(File directory) {
- List<String> result = new ArrayList<String>();
- if (directory.exists()) {
- getFiles0(directory, result, "");
- }
- Collections.sort(result);
- return result;
- }
-
- protected void getFiles0(File directory, List<String> result, String prefix) {
- //TODO put the hardcored value in a property!!!
- if (directory.getName().equals("data")) return;
- final String[] strings = directory.list(versionnableFilenameFilter);
- boolean first = prefix.equals("");
- final String newPrefix = (first ? "" : prefix + File.separator);
-
- for (String filename : strings) {
- final File dir = new File(directory, filename);
- if (dir.isDirectory())
- getFiles0(dir, result, newPrefix + dir.getName());
- else result.add(newPrefix + dir.getName());
- }
- }
-
- protected void assertFileExists(File file, String msg) {
- if (file == null || !file.exists())
- throw new VCSRuntimeException(msg + " (file passed : [" + file + "])");
- }
-}
Deleted: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/ConnectionState.java
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/ConnectionState.java 2008-04-15 09:06:30 UTC (rev 788)
+++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/ConnectionState.java 2008-04-15 09:09:28 UTC (rev 789)
@@ -1,35 +0,0 @@
-/*
-* \#\#% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 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;
-
-/**
- * Une enumeration pour definir l'�tat du connexion � un serveur vcs.
- *
- * @author chemit
- */
-public enum ConnectionState {
- /** lorsque la connexion n'a pas encore initialis�e */
- UNDEFINED,
- /** lorsque la connexion est ok, mais que l'on est pas connect� */
- OFF_LINE,
- /** lorsque la connexion est �tablie avec succes */
- ON_LINE,
- /** lorsque la connexion a tent�e de s'initialiser sans succes */
- ERROR
-}
Deleted: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSAction.java
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSAction.java 2008-04-15 09:06:30 UTC (rev 788)
+++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSAction.java 2008-04-15 09:09:28 UTC (rev 789)
@@ -1,92 +0,0 @@
-/* ##%
-* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin,
-* Benjamin Poussin, 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 static org.codelutin.i18n.I18n._;
-import static org.codelutin.i18n.I18n.n_;
-
-/**
- * a VCSAction represents an action that can be realized on a file in working
- * copy or on remote repository.
- * <p/>
- * Each <code>VCSAction</code> has 4 properties :
- * <ul>
- * <li>libelle : i18n to be used for this action</li>
- * <li>visible : flag to say if action should be visible in ui</li>
- * <li>backup : flag to say if this action need backup</li>
- * <li>write : flag to say if this action need write access to repository</li>
- * </ul>
- *
- * @author chemit
- */
-(a)org.codelutin.i18n.I18nable
-public enum VCSAction {
-
- /** to add an unversionned file on repository */
- ADD(n_("lutinutil.vcs.action.add"), true, false, true, true),
- /** to delete locally and from repository */
- DELETE(n_("lutinutil.vcs.action.delete"), true, true, true, true),
- /** to get another version from repository */
- UPDATE(n_("lutinutil.vcs.action.update"), true, true, false, false),
- /** to get a clean copy from repository */
- OVERWRITE_AND_UPDATE(n_("lutinutil.vcs.action.overwriteAndUpdate"), true, true, false, false),
- /** commit a modification to repository */
- COMMIT(n_("lutinutil.vcs.action.commit"), true, false, true, true),
- /** to rollback to working base revision */
- REVERT(n_("lutinutil.vcs.action.revert"), true, true, false, false),
- /** to acquire a file from repository */
- CHECKOUT(n_("lutinutil.vcs.action.checkout"), true, false, false, false),
- /** to obtain the changelog of a file */
- CHANGELOG(n_("lutinutil.vcs.action.changeLog"), false, false, false, false),
- /** to obtain diif */
- DIFF(n_("lutinutil.vcs.action.diff"), false, false, false, false);
-
- /** libelle of the action */
- private final String libelle;
- /** flag to say if action should be visible in ui */
- private final boolean visible;
- /** flag to say if this action need backup */
- private final boolean backup;
- /** flag to say if this action need write access to repository */
- private final boolean write;
-
- VCSAction(String libelle, boolean visible, boolean backup, boolean commit, boolean write) {
- this.libelle = libelle;
- this.visible = visible;
- this.backup = backup;
- this.write = write;
- }
-
- public String getLibelle() {
- return _(libelle);
- }
-
- public boolean isVisible() {
- return visible;
- }
-
- public boolean isBackup() {
- return backup;
- }
-
- public boolean isWrite() {
- return write;
- }
-}
\ No newline at end of file
Deleted: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSConfig.java
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSConfig.java 2008-04-15 09:06:30 UTC (rev 788)
+++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSConfig.java 2008-04-15 09:09:28 UTC (rev 789)
@@ -1,97 +0,0 @@
-/*
-* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 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 java.io.File;
-
-/**
- * Contract to be realised by a VCS config used in VCSHandler
- *
- * @author chemit
- */
-public interface VCSConfig {
-
- /**
- * find out if a connection to remote vcs servsder can be etablished.
- * <p/>
- * Note : The method is safe and will not throw any exception.
- *
- * @return <code>true</code> if connection to remote vcs server can be
- * etablished.
- */
- boolean canConnect();
-
- /** @return <code>true</code> if handler is connected to remote vcs server */
- boolean isConnected();
-
- /** @return the current connexion state */
- ConnectionState getConnectionState();
-
- /** @return the type of vcs used */
- VCSType getType();
-
- /** @return <code>true</code> if ssh connexion is used */
- boolean isUseSshConnexion();
-
- /** @return the url of hostname */
- String getHostName();
-
- /** @return location of the private ssh2 key file */
- File getKeyFile();
-
- /** @return the user connexion login */
- String getUserName();
-
- /** @return <code>true</code> if user ssh2 pair keys use a passphrase */
- boolean isNoPassPhrase();
-
- //char[] getPassphrase();
-
- /** @return the full location path of the remote container of module */
- String getRemotePath();
-
- /** @return the name of remote module */
- String getRemoteDatabase();
-
- /** @return the full url path to the remote repository (with module name include) */
- String getRemoteDatabasePath();
-
- //String getLocalDatabase();
-
- File getLocalDatabasePath();
-
- /** @return the type of reposotory used (head,tags,branches,...) */
- VCSTypeRepo getTypeRepo();
-
- Class<? extends VCSHandler> getHandlerClass();
-
- /** @return <code>true</code> if no connexion is etablish at current time */
- boolean isOffline();
-
- /** @return <code>true</code> if remote repository is read-only */
-
- boolean isReadOnly();
-
- /** @return <code>true</code> if vcs handler is finely init */
-
- boolean isInit();
-
- /** method to validate vcs configuration. */
- void validate();
-}
Deleted: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSException.java
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSException.java 2008-04-15 09:06:30 UTC (rev 788)
+++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSException.java 2008-04-15 09:09:28 UTC (rev 789)
@@ -1,51 +0,0 @@
-/* *##%
-* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin,
-* Benjamin Poussin, 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;
-
-
-/**
- * A generic vcs exception.
- *
- * @author chemit
- */
-
-public class VCSException extends Exception {
-
- private static final long serialVersionUID = -2665066202505740998L;
-
- public VCSException() {
- super();
- }
-
- public VCSException(String message) {
- super(message);
- }
-
- public VCSException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public VCSException(Throwable cause) {
- super(cause);
- }
-
-}
-
-
Deleted: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSFileState.java
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSFileState.java 2008-04-15 09:06:30 UTC (rev 788)
+++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSFileState.java 2008-04-15 09:09:28 UTC (rev 789)
@@ -1,258 +0,0 @@
-package org.codelutin.vcs;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-
-/**
- * This class represents the vcs state of a file in a working copy or on remote
- * repository.
- * <br/>
- * For a defined file in a working copy, we only use a instance of the
- * class, {@link VCSFileStateManager} is responsible of instanciate thoses
- * objects and store them in a cache.
- * <br/>
- * use method {@link #doSynch(VCSHandler,long)} to doSynch whatever
- * local file state.
- * use method {@link #doSynch(VCSHandler,long,boolean)} to doSynch only
- * if local file state changed (with true value)
- *
- * @see VCSState
- * @see VCSFileStateManager
- */
-public class VCSFileState implements Serializable, Cloneable {
-
- /** to use log facility, just put in your code: log.info(\"...\"); */
- static protected final Log log = LogFactory.getLog(VCSFileState.class);
-
- /**
- * working copy file to deal with (could not exists in file only exists
- * on remote repository)
- */
- protected File file;
- /** a optional module name (if defined, will change getModuleRelativeFileName behavior) */
- protected String moduleName;
- /**
- * relative path on local file system (use File.separator) to root of local
- * working copy
- */
- protected String localPath;
- /**
- * relative path on remote repository (use '/' (should be Remote.separator)
- * to root of this repository
- */
- protected String remotePath;
- /** timestamp of last doSynch or -1 if no doSynch was previously done */
- protected long timestamp;
- /** state of the file */
- protected VCSState state;
- /**
- * index used to identify uniquely each instance (hashcode of
- * file.getAbsolutePath())
- */
- protected int key;
- /** revision of this file, or null if unversionned */
- protected Long rev;
- /** changeLog of the file */
- protected String changeLog;
- /** diff of the file */
- protected String diff;
- /** action to be programmed for this state */
- protected VCSAction action;
-
- private static final long serialVersionUID = -815443990862836772L;
-
- /**
- * protected access restriction : you should not instanciate directly
- * this class, but use {@link VCSFileStateManager} to do it.
- *
- * @param handler the vcs handler used with this working copy
- * @param file file to be handled
- */
- protected VCSFileState(VCSHandler handler, File file) {
- this.file = file;
- this.key = file.getAbsolutePath().hashCode();
- String path = file.getAbsolutePath();
- String rootPath = handler.getLocalDatabasePath().getAbsolutePath();
-
- if (!path.startsWith(rootPath)) {
- throw new VCSRuntimeException("could not create a VCSFileState " +
- "for a file not in the root working copy registered in " +
- "vcsHandler, but was : [" + file + " ::" +
- handler.getLocalDatabasePath() + " ]");
- }
- this.localPath = path.substring(rootPath.length() + 1);
- // by default moduleName is the first dir of localpath (if any)
- int index = this.localPath.indexOf(File.separator);
- if (index == -1) {
- // this is a module directory
- this.moduleName = this.localPath;
- this.localPath = "";
- } else {
- this.moduleName = this.localPath.substring(0, index);
- }
-
- resetState();
- }
-
- public boolean existLocally() {
- return file.exists();
- }
-
- public String getLocalPath() {
- return localPath;
- }
-
- public String getModuleName() {
- return moduleName;
- }
-
- public String getModuleRelativeFileName() {
- return "".equals(moduleName) ? getLocalPath() :
- "".equals(localPath) ? "" : localPath.substring(moduleName.length() + 1);
- }
-
- public String[] getFileNamePath() {
- // TODO Should use File.separator
- return getModuleRelativeFileName().split(File.separator);
- }
-
- public String getRemotePath() {
- if (remotePath == null)
- remotePath = VCSHelper.convertToRemoteName(localPath);
- return remotePath;
- }
-
- public VCSState getState() {
- return state;
- }
-
- public long getTimestamp() {
- return timestamp;
- }
-
- public File getFile() {
- return file;
- }
-
- public String getChangeLog() {
- return changeLog;
- }
-
- public Long getRev() {
- return rev;
- }
-
- public VCSAction getAction() {
- return action;
- }
-
- /**
- * reset synch for this instance : after this invocation,
- * the method {@link #wasSynch()} will return <code>true</code> to means
- * that no synch info are available.
- */
- public void resetState() {
- state = null;
- timestamp = -1;
- }
-
- /**
- * @return <code>true</code> if there at least one invocation of
- * {@link #doSynch(VCSHandler,long)} or
- * {@link #doSynch(VCSHandler,long,boolean)}
- * was made and no invocation of {@link #resetState()}
- * was made after.
- */
- public boolean wasSynch() {
- return state != null && timestamp != -1;
- }
-
- /**
- * @return <code>true</code> if this instance <code>wasSynch</code> and
- * the file was not modified since last synch.
- */
- public boolean isLocallySynch() {
- return wasSynch() && timestamp <= file.lastModified();
- }
-
- /**
- * doSynch this instance with remote repository and put a new timestamp
- * the one passed as parameter.
- *
- * @param handler vcs handler to use
- * @param timestamp the new synch timestamp
- */
- public void doSynch(VCSHandler handler, long timestamp) {
- doSynch(handler, timestamp, false);
- }
-
- /**
- * doSynch this instance with remote repository and put a new timestamp
- * the one passed as parameter.
- * Do not doSynch if <code>ifFileChanged</code> is <code>true</code>
- * and file was not modify since last synch.
- *
- * @param handler vcs handler to use
- * @param timestamp the new synch timestamp
- * @param ifFileChanged if <code>true</code> will doSynch only if file
- * was locally modified after last doSynch
- */
- public void doSynch(VCSHandler handler, long timestamp,
- boolean ifFileChanged) {
- //TODO should deal with possibility of file existed but no more...
- boolean needSynch = !wasSynch() ||
- !ifFileChanged || timestamp <= file.lastModified();
-
- try {
- if (needSynch) {
- this.timestamp = timestamp;
- Collection tmp = new ArrayList();
- this.state = handler.getState(file, tmp);
- if (!tmp.isEmpty()) this.rev = (Long) tmp.iterator().next();
- log.info(" new synch " + this);
- }
- } catch (VCSException e) {
- log.warn("could not acquire state for " + this + " : " + e.getMessage());
- resetState();
- }
- }
-
- @Override
- public boolean equals(Object o) {
- return this == o || !(o == null || getClass() != o.getClass()) &&
- localPath.equals(((VCSFileState) o).localPath);
- }
-
- @Override
- public int hashCode() {
- return localPath.hashCode();
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append(localPath).append('(').append(key).append(')').
- append('|').append(state).append('|').append(timestamp);
- return sb.toString();
- }
-
- @Override
- public VCSFileState clone() throws CloneNotSupportedException {
- return (VCSFileState) super.clone();
- }
-
-
- public void setChangeLog(String changeLog) {
- this.changeLog = changeLog;
- }
-
- public void setAction(VCSAction action) {
- this.action = action;
- }
-}
-
Deleted: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSFileStateManager.java
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSFileStateManager.java 2008-04-15 09:06:30 UTC (rev 788)
+++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSFileStateManager.java 2008-04-15 09:09:28 UTC (rev 789)
@@ -1,276 +0,0 @@
-/* ##%
-* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin,
-* Benjamin Poussin, 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.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.TreeMap;
-
-/**
- * Classe responsable de la gestion des {@link VCSFileState}.
- * <p/>
- * Elle permet leur instanciation, et g�re un cache de ces objets, la politique
- * �tant de n'instancier qu'une seule fois et ensuite d'utiliser les methodes de
- * synchronisations.
- * <br/>
- * TODO Doc
- * {@link #doSynch()}
- * {@link #getState(long,File)} ()}
- * {@link #doAdd(VCSHandler,File)}
- * {@link #doDelete(File)}
- * {@link #doClear()}
- * {@link #doReset()}
- *
- * @author chemit
- */
-public class VCSFileStateManager {
-
- protected static VCSHandler getVCSHanler() {
- return VCSHandlerFactory.getHandler();
- }
-
- static public List<VCSFileState> doScan(VCSHandler handler, File root, boolean changeLog,
- VCSState... states) throws VCSException {
- // TODO on devrait changer l'algorithme, pour ne recuperer
- // TODO que ce qui est reellement est necessaire
-
- // recupereration des fichier locaux
- List<String> localFileNames = handler.getLocalStorageNames(root);
-
- // recuperation des fichiers distants
- List<String> remoteFileNames = handler.getRemoteStorageNames(root);
-
- // recuperation des fichiers uniquement presents sur le repository distant
- List<String> newRemoteName = new ArrayList<String>(remoteFileNames);
- newRemoteName.removeAll(localFileNames);
-
- List<VCSFileState> vcsstates = new ArrayList<VCSFileState>();
-
- long timestamp = System.nanoTime();
-
- for (String filePath : localFileNames) {
- File f = new File(root, filePath);
- vcsstates.add(getState(timestamp, f));
- }
-
- for (String filePath : newRemoteName) {
- File f = new File(root, filePath);
- vcsstates.add(getState(timestamp, f));
- }
-
- final List<VCSFileState> result = filter(vcsstates, states);
- if (changeLog) {
- // compute all change log for selected files
- for (VCSFileState vcsFileState : result)
- vcsFileState.setChangeLog(handler.getChangeLog(vcsFileState.getFile()));
- }
- return result;
- }
-
- // /////////////////////////////////////////////////////////////////////////
- // / methodes getState(XXX) pour obtenir des etats du cache (avec creation
- // / si besoin est)
- // /////////////////////////////////////////////////////////////////////////
-
- static public VCSFileState getState(long timestamp, File f) {
- return getState(getVCSHanler(), timestamp, f);
- }
-
- static public VCSFileState getState(boolean synch, File f) {
- return getState(getVCSHanler(), synch, f);
- }
-
- static public VCSFileState getState(VCSHandler handler, boolean synch,
- File f) {
- VCSFileState result;
- synchronized (cache) {
- final int key = getKey(f);
- result = cache.get(key);
- if (result == null) {
- result = doAdd(handler, f);
- }
- if (synch) {
- result.doSynch(handler, System.nanoTime());
- }
- }
- return result;
- }
-
- static public VCSFileState getState(VCSHandler handler, long timestamp, File f) {
- VCSFileState result;
- synchronized (cache) {
- final int key = getKey(f);
- result = cache.get(key);
- if (result == null) {
- result = doAdd(handler, f);
- }
- result.doSynch(handler, timestamp);
- }
- return result;
- }
-
- static public VCSFileState[] getState(VCSHandler handler, boolean synch,
- Collection<File> f) {
- VCSFileState[] result = new VCSFileState[f.size()];
-
- int index = 0;
- for (File file : f) {
- result[index] = getState(handler, synch, file);
- index++;
- }
- return result;
- }
-
- // /////////////////////////////////////////////////////////////////////////
- // / methodes doSynch(XXX) pour synchroniser les �tats du cache
- // /////////////////////////////////////////////////////////////////////////
-
- static public void doSynch() {
- doSynch(getVCSHanler(), false, System.nanoTime());
- }
-
- static public void doSynch(VCSHandler handler, boolean ifFileChanged,
- long timestamp) {
- synchronized (cache) {
- for (Integer hashcode : cache.keySet()) {
- cache.get(hashcode).doSynch(handler, timestamp, ifFileChanged);
- }
- }
- }
-
- static public void doSynch(VCSHandler handler, Collection<File> files) {
- doSynch(handler, false, System.nanoTime(), files);
- }
-
- static public void doSynch(VCSHandler handler, boolean ifFileChanged,
- long timestamp, Collection<File> files) {
- synchronized (cache) {
- for (File file : files) {
- VCSFileState vcsFileState = cache.get(getKey(file));
- if (vcsFileState == null)
- vcsFileState = doAdd(getVCSHanler(), file);
- vcsFileState.doSynch(handler, timestamp, ifFileChanged);
- }
- }
- }
-
- // /////////////////////////////////////////////////////////////////////////
- // methodes protected doAdd(XXX) pour ajouter directement des etats au cache
- // /////////////////////////////////////////////////////////////////////////
-
- static protected VCSFileState doAdd(VCSHandler handler, File f) {
- VCSFileState result;
- synchronized (cache) {
- final int key = getKey(f);
- cache.put(key, result = new VCSFileState(handler, f));
- log.debug("[cache size:" + cache.size() + "] : " + result);
- }
- return result;
- }
-
- // ////////////////////////////////////////////////////////////////////////
- // methodes doDelete(XXX) pour supprimer des etats du cache
- // ////////////////////////////////////////////////////////////////////////
-
- static public void doDelete(File file) {
- synchronized (cache) {
- cache.remove(getKey(file));
- }
- }
-
- // /////////////////////////////////////////////////////////////////////////
- // / clean cache methods
- // /////////////////////////////////////////////////////////////////////////
-
- static public void doReset() {
- synchronized (cache) {
- for (Integer hashcode : cache.keySet()) {
- cache.get(hashcode).resetState();
- }
- }
- }
-
- static public void doClear() {
- synchronized (cache) {
- cache.clear();
- }
- }
-
- protected VCSFileStateManager() {
- }
-
- static private int getKey(File file) {
- return file.getAbsolutePath().hashCode();
- }
-
- /** to use log facility, just put in your code: log.info(\"...\"); */
- static protected final Log log = LogFactory
- .getLog(VCSFileStateManager.class);
-
- /** cache of VCSFileState, keys are relativePath.hashCode of each entry */
- static final protected java.util.Map<Integer, VCSFileState> cache = new TreeMap<Integer, VCSFileState>();
-
- // /////////////////////////////////////////////////////////////////////////
- // / utils methods (filter and explode from VCSAction and VCSState)
- // /////////////////////////////////////////////////////////////////////////
- @SuppressWarnings({"unchecked"})
- static public List<VCSFileState>[] explode(List<VCSFileState> source,
- VCSState... wanted) {
- if (wanted.length == 0)
- wanted = VCSState.values();
- int nbState = wanted.length;
- List<VCSFileState>[] result = new List[nbState];
- for (int i = 0; i < nbState; i++) {
- result[i] = new ArrayList<VCSFileState>();
- }
- List<VCSState> states = java.util.Arrays.asList(wanted);
- VCSState state;
- int index;
- for (VCSFileState fileState : source) {
- state = fileState.getState();
- if ((index = states.indexOf(state)) > -1) {
- result[index].add(fileState);
- }
- }
- return result;
- }
-
- static public List<VCSFileState> filter(List<VCSFileState> source,
- VCSState... wanted) {
- List<VCSFileState> result = new ArrayList<VCSFileState>();
- List<VCSState> states = java.util.Arrays.asList(wanted);
-
- if (wanted.length == 0) {
- return result;
- }
- for (VCSFileState fileState : source) {
- VCSState currentState = fileState.getState();
- if (states.contains(currentState)) {
- result.add(fileState);
- }
- }
- return result;
- }
-}
Deleted: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSHandler.java
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSHandler.java 2008-04-15 09:06:30 UTC (rev 788)
+++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSHandler.java 2008-04-15 09:09:28 UTC (rev 789)
@@ -1,320 +0,0 @@
-/* *##%
-* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin,
-* Benjamin Poussin, 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 java.io.File;
-import java.io.FileFilter;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * Contract of an VCS handler
- *
- * @author chemit
- */
-
-public interface VCSHandler {
-
- /**
- * TODO renommer en workingCopyRootFile
- *
- * @return
- */
- File getLocalDatabasePath();
-
- /**
- * init working copy, says if it is the first we use it it, we will checkout
- * the databaseDirectory directory
- *
- * @throws VCSException if any exception while init
- */
- void initWorkingCopy() throws VCSException;
-
- /** delete the local working copy with all his files */
- void deleteWorkingCopy();
-
- /** @return the complete remote url to acces repository */
- String getRemoteUrl();
-
- /** @return the config used by this handler */
- VCSConfig getConfig();
-
- /**
- * @return a
- * <code>FilenameFilter<code> to detect all files and directories in a vcs working copy that
- * must be handled by vcs
- */
- FilenameFilter getVersionnableFilenameFilter();
-
- /**
- * @return a
- * <code>FileFilter<code> to detect all files and directories in a vcs working copy that
- * must be handled by vcs
- */
- FileFilter getVersionnableFileFilter();
-
- /**
- * @return name of directory used by vcs to store in working copy, a data's
- * directory configuration (e.g CVS for cvs and .svn for svn)
- */
- String getConfLocalDirname();
-
- /**
- * @return name of the file used by vcs to store in working copy
- * configuration directory entries of data's directory (e.g Entries
- * for cvs and entries for svn)
- */
- String getConfLocalEntriesFilename();
-
- VCSState getState(File fileState, Collection tmp) throws VCSException;
-
- VCSState getState(File file, Collection tmp, boolean noremote) throws VCSException;
-
- /**
- * @param file file to test
- * @return <code>true</code> if <code>file</code> is on remote
- * repository, <code>false</code> otherwise.
- */
- boolean isOnRemote(File file);
-
- /**
- * @param file file to test
- * @return <code>true</code> if file is uptodate,<code>false</code>
- * otherwise.
- * @throws VCSException if any exception while operation
- */
- boolean isUpToDate(File file) throws VCSException;
-
- /**
- * @param file file to test
- * @return <code>true</code> if file is handled by VCS,<code>false</code>
- * otherwise.
- */
- boolean isVersionnableFile(File file);
-
- /**
- * add on remote repository somes directories
- *
- * @param commitMessage commit message
- * @param dirNames names of the directories to create on remote repository (could
- * used multi-level directories)
- * @throws VCSException if any exception while operation
- */
- void makeRemoteDir(String commitMessage, String... dirNames)
- throws VCSException;
-
- /**
- * delete on remote repository somes directories
- *
- * @param commitMessage commit message
- * @param dirNames names of the directories to delete on remote repository (could
- * used multi-level directories)
- * @throws VCSException if any exception while operation
- */
- void deleteRemoteDir(String commitMessage, String... dirNames)
- throws VCSException;
-
- /**
- * add a list of files into repository
- *
- * @param files files to add
- * @param msg message for VCS commit, if <code>null</code> then no commit
- * is performed
- * @return revision of the operation
- * @throws VCSException if any exception while operation
- */
- long add(List<File> files, String msg) throws VCSException;
-
- // void add(File file, String msg) throws VCSException;
-
- /**
- * delete a list of files from repository
- *
- * @param files files to delete
- * @param msg message for VCS commit, if <code>null</code> then no commit
- * is performed
- * @throws VCSException if any exception while operation
- */
- void delete(List<File> files, String msg) throws VCSException;
-
- /**
- * revert a list of files from repository
- *
- * @param files files to revert
- * @throws VCSException if any exception while operation
- */
- void revert(List<File> files) throws VCSException;
-
- /**
- * commit a list of files into repository
- *
- * @param files files to commit
- * @param msg message for VCS commit
- * @return revision of the operation
- * @throws VCSException if any exception while operation
- */
- long commit(List<File> files, String msg) throws VCSException;
-
- /**
- * update a file to repository to a certain revision
- *
- * @param file file to update
- * @param revision object representing a revision for the current VCS
- * @throws VCSException if any exception while operation
- */
- void update(File file, Object revision) throws VCSException;
-
- /**
- * update a file to repository
- *
- * @param file file to update
- * @throws VCSException if any exception while operation
- */
- void update(File file) throws VCSException;
-
- /**
- * checkout a module from repository to a local file
- *
- * @param destDir local file where to checkout
- * @param module module's name to checkout
- * @param recurse flag to say to recurse checkout or not.
- * @throws VCSException if any exception while operation
- */
- void checkout(File destDir, String module, boolean recurse)
- throws VCSException;
-
- void checkoutFile(File destDir, String module) throws VCSException;
-
- long checkoutOnlyTheDirectory(File root, Object revision) throws VCSException;
-
- /**
- * TODO This is not the good place : VCS != Storage
- *
- * @param directory directory to treate
- * @return TODO
- * @throws VCSException TODO
- */
- List<String> getRemoteStorageNames(File directory) throws VCSException;
-
- /**
- * TODO This is not the good place : VCS != Storage
- *
- * @param directory directory to treate
- * @return TODO
- */
- List<String> getLocalStorageNames(File directory);
-
- /**
- * @param f local file to treate
- * @return current local revision of a file
- * @throws VCSException TODO
- */
- Object getRevision(File f) throws VCSException;
-
- /**
- * Obtain the list of log entries for the file
- *
- * @param startRevision TODO
- * @param endRevision TODO
- * @param file file to treate
- * @return list of log entries for this file between two revisions
- * @throws VCSException if any exception while grabbing infos
- */
- List getLog(Object startRevision, Object endRevision, File file)
- throws VCSException;
-
- /**
- * obtain the content of a file for a specific revision
- *
- * @param file file to obtain
- * @param revision revision treated
- * @return the content of the file on repository for the specific revision
- * passed as arguement.
- * @throws VCSException if any exception while operation
- * @throws java.io.IOException TODO
- */
- String getFileContent(File file, Object revision) throws VCSException, IOException;
-
- /**
- * Build the changelog for <code>file</code> from current revision of this
- * local file against head repository head version. For each revision
- * between current revision and head revision of this file, we give the
- * following informations :
- * <ul>
- * <li>revision number</li>
- * <li>author</li>
- * <li>date</li>
- * <li>commit message</li>
- * </ul>
- *
- * @param file file to treate
- * @return a string representation of change log for the local file to the
- * head ?
- * @throws VCSException if any exception while building changelog
- */
- String getChangeLog(File file) throws VCSException;
-
- /**
- * Generate in the ouputstream the diff between the current revision of the
- * local file against headest revision on repository. <br>
- * If file is uptodate, then does nothing.
- *
- * @param file the file to treate
- * @return the diff
- * @throws VCSException inf any exception while building diff, such as :
- * <ul>
- * <li>unversionned file</li>
- * <li>unexistant file locally</li>
- * <li>locally modified file ?</li>
- * <li>...</li>
- * </ul>
- * @throws java.io.IOException if io problem with streams
- */
- String getDiff(File file) throws VCSException, IOException;
-
- /**
- * Generate in the ouputstream the diff between the current revision of the
- * local file against another revision (<code>againstRevision</code>) on
- * repository. <br>
- * If file is uptodate, then does nothing.
- *
- * @param file the file to treate
- * @param againstRevision the against revision to use
- * @return the diff
- * @throws VCSException inf any exception while building diff, such as :
- * <ul>
- * <li>unversionned file</li>
- * <li>unexistant file locally</li>
- * <li>locally modified file ?</li>
- * <li>...</li>
- * </ul>
- * @throws java.io.IOException if problem with streams
- */
- String getDiff(File file, Object againstRevision) throws VCSException, IOException;
-
- /**
- * test if connection is ok
- *
- * @throws VCSException if any problem
- */
- void testConnection() throws VCSException;
-}
\ No newline at end of file
Deleted: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSHandlerFactory.java
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSHandlerFactory.java 2008-04-15 09:06:30 UTC (rev 788)
+++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSHandlerFactory.java 2008-04-15 09:09:28 UTC (rev 789)
@@ -1,90 +0,0 @@
-/* *##%
-* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin,
-* Benjamin Poussin, 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 static org.codelutin.i18n.I18n._;
-
-/**
- * TODO This doc is not up to date and must be redone...
- *
- * @author chemit
- * @see VCSConfig
- * @see VCSHandler
- */
-(a)org.codelutin.i18n.I18nable
-public class VCSHandlerFactory {
-
- private static VCSConfig config;
-
- private static VCSHandler handler;
-
- public static VCSConfig getConfig() {
- assertConfigIsNotNull(config);
- return config;
- }
-
- public static void setConfig(VCSConfig value) {
- config =value;
- }
-
- public static VCSHandler getHandler() {
- if (handler == null) {
- synchronized (VCSHandlerFactory.class) {
- handler = newHandler(getConfig());
- }
- }
- return handler;
- }
-
- /**
- * instanciate a new handler, using a previously instanciate handler config.
- * <p/>
- * the method will produce a runtime exception if config is null and not init.
- *
- * @param config config to use
- * @return the new handler instance
- */
- protected static VCSHandler newHandler(VCSConfig config) {
- assertConfigIsInit(config);
- try {
- Class<? extends VCSHandler> aClass = getConfig().getHandlerClass();
- return aClass.getConstructor(VCSConfig.class).newInstance(getConfig());
- } catch (Exception e) {
- throw new VCSRuntimeException(e);
- }
- }
-
- private static void assertConfigIsNotNull(VCSConfig vcsConfig) {
- if (vcsConfig == null) {
- throw new VCSRuntimeException(_("lutinutil.error.init.no.config", VCSHandlerFactory.class.getName()));
- }
- }
-
- private static void assertConfigIsInit(VCSConfig config) {
- assertConfigIsNotNull(config);
- if (!config.isInit()) {
- throw new VCSRuntimeException(_("lutinutil.error.init.config", config));
- }
- }
-
- protected VCSHandlerFactory() {
- // singleton idiom
- }
-}
\ No newline at end of file
Deleted: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSHelper.java
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSHelper.java 2008-04-15 09:06:30 UTC (rev 788)
+++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSHelper.java 2008-04-15 09:09:28 UTC (rev 789)
@@ -1,216 +0,0 @@
-/* *##%
-* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin,
-* Benjamin Poussin, 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.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import static org.codelutin.i18n.I18n._;
-
-import java.io.File;
-import java.util.EnumSet;
-
-(a)org.codelutin.i18n.I18nable
-public class VCSHelper {
-
- private static final String LOCAL_SEP = File.separator;
- private static final String LOCAL_SEP_PATTERN = "\\".equals(LOCAL_SEP) ?
- LOCAL_SEP + LOCAL_SEP : LOCAL_SEP;
- private static final String REMOTE_SEP = "/";
- private static final String REMOTE_SEP_PATTERN = "/";
-
-
- /** to use log facility, just put in your code: log.info(\"...\"); */
- static private Log log = LogFactory.getLog(VCSHelper.class);
-
- public static boolean isFileInWorkingCopy(File parent, String name, VCSHandler handler, boolean underVCS) {
- if (parent == null || name == null)
- throw new RuntimeException(VCSHelper.class.getName() +
- "#isFileInWorkingCopy can not be invoked with some " +
- "null parameter but was. [" + parent + "," + name + "," +
- handler + "]");
- return isFileInWorkingCopy(new File(parent, name), handler, underVCS);
- }
-
- public static boolean isFileInWorkingCopy(File file, VCSHandler handler, boolean underVCS) {
- if (file == null || handler == null)
- throw new RuntimeException(VCSHelper.class.getName() +
- "#isFileInWorkingCopy can not be invoked with some " +
- "null parameter but was. [" + file + "," + handler + "]");
- String rootPath = VCSHandlerFactory.getConfig().getLocalDatabasePath().getAbsolutePath();
- String localPath = file.getAbsolutePath();
- if (localPath.startsWith(rootPath) && !underVCS) {
- return true;
- }
- final File realDir = file.isDirectory() ? file : file.getParentFile();
- return isFileInCheckedDir(realDir, handler);
- }
-
- public static boolean isFileInCheckedDir(File file, VCSHandler handler) {
- if (file == null || handler == null)
- throw new RuntimeException(VCSHelper.class.getName() +
- "#isFileInCheckedDir can not be invoked with some " +
- "null parameter but was. [" + file + "," + handler + "]");
- final File realDir = file.isDirectory() ? file : file.getParentFile();
- return (new File(realDir, handler.getConfLocalDirname()).exists());
-
- }
-
- public static void assertFileInWC(File file, VCSHandler handler) {
- if (!isFileInWorkingCopy(file, handler, false))
- throw new VCSRuntimeException("the file [" + file +
- "] is not in the working copy [" +
- handler.getLocalDatabasePath() + "]");
- }
-
- public static String getRemoteRelativePath(File f, VCSHandler handler) {
- if (!isFileInWorkingCopy(f, handler, false)) return null;
- //System.out.println("file on vcs working copy : "+f);
- String rootPath = handler.getConfig().getLocalDatabasePath().getAbsolutePath();
- String localPath = f.getAbsolutePath();
- if (!localPath.startsWith(rootPath)) return null;
- localPath = localPath.substring(rootPath.length() + 1);
- return convertToRemoteName(localPath);
- }
-
- public static String getLocalRelativePath(String remoteRelativePath, VCSHandler handler) {
- String localPath = convertToLocalName(remoteRelativePath);
- final File file = new File(handler.getConfig().getLocalDatabasePath(), localPath);
- if (!isFileInWorkingCopy(file, handler, false)) return null;
- return localPath;
- }
-
- public static String convertToRemoteName(String txt) {
- return txt.replaceAll(LOCAL_SEP_PATTERN, REMOTE_SEP);
- }
-
- public static String convertToLocalName(String txt) {
- return txt.replaceAll(REMOTE_SEP_PATTERN, LOCAL_SEP);
- }
-
- public static void doCheckoutDir(VCSHandler handler, File... dirs) {
- for (File dir : dirs) {
- try {
- if (!dir.exists() || !isFileInWorkingCopy(dir, handler, true)) {
- handler.checkoutOnlyTheDirectory(dir, null);
- }
- } catch (Exception eee) {
- log.warn(_("lutinutil.error.checkout.dir", dir), eee);
- break;
- }
- }
- }
-
- /**
- * @param typeRepo the type of repo to used
- * @param remotePath the unclean remote path to use
- * @return the remote path from the old one according to given type repo
- */
- public static String getRemotePath(VCSTypeRepo typeRepo, String remotePath) {
- String result = cleanRemotePath(remotePath);
- switch (typeRepo) {
- case BRANCH:
- case TAG:
- result = remotePath + '/' + typeRepo.getPath();
- break;
- case HEAD:
- result = remotePath;
- break;
- }
- return result;
- }
-
- /**
- * @param typeRepo the type of repo to use
- * @param version the version to use
- * @return the remoteDatabase according to type of repo and version
- */
- public static String getRemoteDatabase(VCSTypeRepo typeRepo, String version) {
- String result = null;
- switch (typeRepo) {
- case BRANCH:
- case TAG:
- result = version;
- break;
- case HEAD:
- result = VCSTypeRepo.HEAD.getPath();
- break;
- }
- return result;
- }
-
- /**
- * to clean a remote path from typeRepo suffix.
- * <p/>
- * For example, having a url svn://XXX/trunk then remove /trunk.
- * <p/>
- * Or if having svn://XXX/branches/YYY then remove /branches/YYY
- * Or if having svn://XXX/tags/YYY then remove /tags/YYY
- *
- * @param remotePath the remote path to clean
- * @return the cleaned remote path
- */
- public static String cleanRemotePath(String remotePath) {
- int pos = remotePath.indexOf(VCSTypeRepo.BRANCH.getPath());
- if (pos > -1) {
- // found a branch
- remotePath = remotePath.substring(0, pos - 1);
- } else {
- pos = remotePath.indexOf(VCSTypeRepo.HEAD.getPath());
- if (pos > -1) {
- // found a branch
- remotePath = remotePath.substring(0, pos - 1);
- } else {
- pos = remotePath.indexOf(VCSTypeRepo.TAG.getPath());
- if (pos > -1) {
- // found a tag
- remotePath = remotePath.substring(0, pos - 1);
- } else {
- // remote path was clean
- }
- }
- }
- return remotePath;
- }
-
-
- /**
- * Obtain the set of permitted vcs actions.
- *
- * @return the EnumSet of authorized action according to current vcs config
- */
- public static EnumSet<VCSAction> getAuthorizedActions() {
- boolean canWrite = hasWriteAccess();
- EnumSet<VCSAction> result= EnumSet.noneOf(VCSAction.class);
- for (VCSAction vcsAction : VCSAction.values()) {
- if (!vcsAction.isWrite() || canWrite) {
- result.add(vcsAction);
- }
- }
- return result;
- }
-
- public static boolean isConnected() {
- return VCSHandlerFactory.getConfig().isConnected();
- }
-
- public static boolean hasWriteAccess() {
- return !VCSHandlerFactory.getConfig().isReadOnly();
- }
-}
\ No newline at end of file
Deleted: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSRepositoryState.java
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSRepositoryState.java 2008-04-15 09:06:30 UTC (rev 788)
+++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSRepositoryState.java 2008-04-15 09:09:28 UTC (rev 789)
@@ -1,201 +0,0 @@
-/* ##%
-* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin,
-* Benjamin Poussin, 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.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.codelutin.vcs.ui.FileStateTableModel;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.List;
-
-/**
- * Permet de rechercher et conserve les differences entre le repository local et
- * distant.
- *
- * @author poussin
- * @author chemit
- */
-public class VCSRepositoryState {
-
- /** to use log facility, just put in your code: log.info(\"...\"); */
- static protected final Log log = LogFactory.getLog(VCSRepositoryState.class);
-
- /** liste des �tats des fichiers scann�s */
- protected List<VCSFileState> states = new ArrayList<VCSFileState>();
-
- /** tableau des model de table (un par �tat VCSState) */
- protected FileStateTableModel[] models;
-
- /** le r�pertoire racine du working copy local */
- protected File root;
-
- /** vcs states to be authorized in this model */
- protected VCSState[] acceptedStates;
-
- /** vcs actions to be authorized in this model */
- protected EnumSet<VCSAction> acceptedActions;
-
- /** vcs handler to use (lazy instanciation) */
- protected VCSHandler handler;
-
- public static final VCSState[] UPDATE_STATES = {
- org.codelutin.vcs.VCSState.OUT_OF_DATE,
- org.codelutin.vcs.VCSState.MODIFIED,
- org.codelutin.vcs.VCSState.OUT_OF_DATE_AND_MODIFIED,
- org.codelutin.vcs.VCSState.UNVERSIONNED,
- org.codelutin.vcs.VCSState.MISSING
- };
-
- /**
- * @param root directory of root local working copy
- * @param actions accepted actions
- * @param modules la liste des modules a traiter
- * @throws VCSException if any problem while building
- */
- protected VCSRepositoryState(File root, EnumSet<VCSAction> actions, File... modules) throws VCSException {
- this.acceptedActions = actions;
- this.root = root;
- this.acceptedStates = UPDATE_STATES;
- // scan all modules
- for (File mod : modules) {
- states.addAll(doScan(mod, acceptedStates));
- }
- }
-
- public VCSHandler getHandler() {
- if (handler == null) {
- handler = VCSHandlerFactory.getHandler();
- }
- return handler;
- }
-
- /**
- * @param handler vcs handler to use for synch operation
- * @throws VCSException if any problem while synchro
- */
- public void doSynch(VCSHandler handler) throws VCSException {
- long timestamp = System.nanoTime();
- for (VCSFileState fileState : states) {
- fileState.doSynch(handler, timestamp);
- }
- }
-
- public File getRoot() {
- return root;
- }
-
- public List<VCSFileState> getStates() {
- return states;
- }
-
- public VCSState[] getAcceptedStates() {
- return acceptedStates;
- }
-
- public FileStateTableModel getModel(VCSState state) {
- return getModels()[state.ordinal()];
- }
-
-
- protected FileStateTableModel[] getModels() {
- if (models == null) {
- models = new FileStateTableModel[VCSState.values().length];
- }
- return models;
- }
-
- public void createUIModels() {
- for (VCSState state : acceptedStates) {
- getModels()[state.ordinal()] = new FileStateTableModel(VCSFileStateManager.filter(states, state), acceptedActions);
- }
- }
-
- public List<VCSFileState> selected(VCSState... wanted) {
- if (wanted.length == 0) {
- wanted = acceptedStates;
- }
- List<VCSFileState> result = new ArrayList<VCSFileState>();
- for (VCSState state : wanted) {
- FileStateTableModel tableModel = getModel(state);
- if (tableModel != null) {
- result.addAll(tableModel.getSelected());
- }
- }
- return result;
- }
-
- public void checkAll(boolean toUse, VCSState... wanted) {
- if (wanted.length == 0) wanted = acceptedStates;
- for (VCSState state : wanted) {
- FileStateTableModel tableModel = getModel(state);
- if (tableModel != null) {
- tableModel.checkAll(0, toUse);
- }
- }
- }
-
- public boolean isModelEmpty() {
- for (VCSState state : acceptedStates) {
- FileStateTableModel tableModel = getModel(state);
- if (tableModel != null && tableModel.getRowCount() > 0) {
- return false;
- }
- }
- return true;
- }
-
- public int getModelSelectedSize() {
- int result = 0;
- for (VCSState state : acceptedStates) {
- result += getModelSelectedSize(state);
- }
- return result;
- }
-
- public boolean isModelEmpty(VCSState state) {
- FileStateTableModel tableModel = getModel(state);
- return !(tableModel != null && tableModel.getRowCount() > 0);
- }
-
- public int getModelSize(VCSState state) {
- FileStateTableModel tableModel = getModel(state);
- return tableModel == null ? 0 : tableModel.getRowCount();
- }
-
- public int getModelSelectedSize(VCSState state) {
- FileStateTableModel tableModel = getModel(state);
- return tableModel == null ? 0 : tableModel.getSelectedSize();
- }
-
- private List<VCSFileState> doScan(File module, VCSState... acceptedStates)
- throws VCSException {
- // obtain list of all VCSFileState found in module directory
- List<VCSFileState> states;
- states = VCSFileStateManager.doScan(getHandler(), module, true, acceptedStates);
- return states;
- }
-
- public EnumSet<VCSAction> getAcceptedActions() {
- return acceptedActions;
- }
-}
Deleted: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSRuntimeException.java
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSRuntimeException.java 2008-04-15 09:06:30 UTC (rev 788)
+++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSRuntimeException.java 2008-04-15 09:09:28 UTC (rev 789)
@@ -1,51 +0,0 @@
-/* *##%
-* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin,
-* Benjamin Poussin, 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;
-
-
-/**
- * A generic runtime vcs exception.
- *
- * @author chemit
- */
-
-public class VCSRuntimeException extends RuntimeException {
-
- private static final long serialVersionUID = -2665066202505740998L;
-
- public VCSRuntimeException() {
- super();
- }
-
- public VCSRuntimeException(String message) {
- super(message);
- }
-
- public VCSRuntimeException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public VCSRuntimeException(Throwable cause) {
- super(cause);
- }
-
-}
-
-
Deleted: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSState.java
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSState.java 2008-04-15 09:06:30 UTC (rev 788)
+++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSState.java 2008-04-15 09:09:28 UTC (rev 789)
@@ -1,156 +0,0 @@
-package org.codelutin.vcs;
-
-import static org.codelutin.i18n.I18n.n_;import static org.codelutin.i18n.I18n._;
-import static org.codelutin.vcs.VCSAction.ADD;
-import static org.codelutin.vcs.VCSAction.CHANGELOG;
-import static org.codelutin.vcs.VCSAction.COMMIT;
-import static org.codelutin.vcs.VCSAction.DELETE;
-import static org.codelutin.vcs.VCSAction.DIFF;
-import static org.codelutin.vcs.VCSAction.OVERWRITE_AND_UPDATE;
-import static org.codelutin.vcs.VCSAction.REVERT;
-import static org.codelutin.vcs.VCSAction.UPDATE;
-
-/**
- * This constants represents all states for a file.
- * Should contains all static data concerning file state (libelle, actions,
- * icon link, color,...).
- * We associate for each state, all VCSActions authorized for this state.
- */
-(a)org.codelutin.i18n.I18nable
-public enum VCSState {
-
- /**
- * when a local file matches the latest remote copy.
- * <br/>
- * The only action for this state is to delete the file, nothing else.
- */
- UP_TO_DATE("uptodate", n_("lutinutil.vcs.state.uptodate"), DELETE),
-
- /**
- * when a local file matches a remote copy but not the latest one.
- * <br/>
- * This state owns 3 actions :
- * <ul>
- * <li>{@link VCSAction#UPDATE}</li>
- * <li>{@link VCSAction#DIFF}</li>
- * <li>{@link VCSAction#CHANGELOG}</li>
- * </ul>
- */
- OUT_OF_DATE("outofdate", n_("lutinutil.vcs.state.outofdate"),
- UPDATE, DIFF, CHANGELOG),
-
- /**
- * when a local file does not matches his remote latest copy, but is based
- * on.
- * This state owns 4 actions :
- * <ul>
- * <li>{@link VCSAction#COMMIT}</li>
- * <li>{@link VCSAction#REVERT}</li>
- * <li>{@link VCSAction#OVERWRITE_AND_UPDATE}</li>
- * <li>{@link VCSAction#DIFF}</li>
- * </ul>
- */
- MODIFIED("modified", n_("lutinutil.vcs.state.modified"),
- COMMIT, OVERWRITE_AND_UPDATE, REVERT, DIFF),
-
- /**
- * when a local file does not match the working version remote copy and
- * there is also new yougest version on remote : this is the worse case
- * (conflict).
- * This state owns 4 actions :
- * <ul>
- * <li>{@link VCSAction#REVERT}</li>
- * <li>{@link VCSAction#OVERWRITE_AND_UPDATE}</li>
- * <li>{@link VCSAction#DIFF}</li>
- * <li>{@link VCSAction#CHANGELOG}</li>
- * </ul>
- */
- OUT_OF_DATE_AND_MODIFIED("outofdateAndModified",
- n_("lutinutil.vcs.state.outofdateAndModified"),
- OVERWRITE_AND_UPDATE, REVERT, DIFF, CHANGELOG),
-
- /**
- * when a local file does not exist on remote repository.
- * * This state owns 1 action :
- * <ul>
- * <li>{@link VCSAction#ADD}</li>
- * </ul>
- */
- UNVERSIONNED("unversionned", n_("lutinutil.vcs.state.unversionned"), ADD),
-
- /**
- * when a file exists on remote repository but not locally.
- * * This state owns 1 action :
- * <ul>
- * <li>{@link VCSAction#UPDATE}</li>
- * </ul>
- */
- MISSING("missing", n_("lutinutil.vcs.state.missing"), UPDATE),
-
- /**
- * when a file is unversionned or missing : this special and durty state
- * correspond for exemple when you want to add a file under a no checked
- * directory...
- * <br/>
- * <b> This state needs special add and update operation to create unchecked
- * directories).</b>
- * This state owns 2 action :
- * <ul>
- * <li>{@link VCSAction#ADD}</li>
- * <li>{@link VCSAction#UPDATE}</li>
- * <p/>
- * </ul>
- */
- UNVERSIONNED_OR_MISSING("unversionnedOrMissing",
- n_("lutinutil.vcs.state.unversionnedOrMissing"), ADD, UPDATE),
-
- /** to deal with other cases (...) */
- UNKNOWN("unknown", n_("lutinutil.vcs.state.unknown"));
-
- /** libelle to be used */
- private final String libelle;
- /** key of the state */
- private final String key;
-
- /** VCSAction associated with this state */
- private final VCSAction[] actions;
-
- VCSState(String key, String libelle, VCSAction... actions) {
- this.libelle = libelle;
- this.actions = actions;
- this.key = key;
- }
-
- public String libelle() {
- return _(libelle);
- }
-
- public VCSAction[] getActions() {
- return actions;
- }
-
- public String getKey() {
- return key;
- }
-
- public boolean authorizeAction(VCSAction... actions) {
- java.util.List<VCSAction> acts = java.util.Arrays.asList(actions);
- for (VCSAction vcsAction : this.actions) {
- if (acts.contains(vcsAction)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * @param key key of required state
- * @return the <code>VCSState</code> with <code>key</code> as key value,
- * or <code>null</code> if no state found.
- */
- public static VCSState valueOfKey(String key) {
- for (VCSState state : VCSState.values())
- if (state.key.equals(key)) return state;
- return null;
- }
-}
\ No newline at end of file
Deleted: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSStatus.java
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSStatus.java 2008-04-15 09:06:30 UTC (rev 788)
+++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSStatus.java 2008-04-15 09:09:28 UTC (rev 789)
@@ -1,32 +0,0 @@
-/* *##%
-* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin,
-* Benjamin Poussin, 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;
-
-public enum VCSStatus {
- NORMAL,
- ADDED,
- MODIFIED,
- DELETED,
- UNVERSIONED,
- MISSING,
- IGNORED,
- CONFLICTED,
- NONE
-}
Deleted: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSType.java
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSType.java 2008-04-15 09:06:30 UTC (rev 788)
+++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSType.java 2008-04-15 09:09:28 UTC (rev 789)
@@ -1,31 +0,0 @@
-/* *##%
-* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin,
-* Benjamin Poussin, 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;
-
-/**
- * This type-safe class representing a type of vcs (SVN,CVS,...)
- *
- * @author chemit
- */
-public enum VCSType {
-
- CVS, SVN
-
-}
Deleted: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSTypeRepo.java
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSTypeRepo.java 2008-04-15 09:06:30 UTC (rev 788)
+++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSTypeRepo.java 2008-04-15 09:09:28 UTC (rev 789)
@@ -1,55 +0,0 @@
-/* *##%
-* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin,
-* Benjamin Poussin, 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;
-
-/**
- * type of repository to used, if no typeRepo (for CVS, use {@link #NONE}
- *
- * @author chemit
- */
-public enum VCSTypeRepo {
- /** head repo : is writable */
- HEAD("trunk", false),
- /** tag repo : readonly */
- TAG("tags", true),
- /** branch repo : should be writable ? */
- BRANCH("branches", false),
- /** no type of repo : readonly */
- NONE(null, true);
-
- /** the path of the type of repo */
- final String path;
-
- /** flag to say this type of repo is readonly or not. */
- final boolean readonly;
-
- VCSTypeRepo(String path, boolean readOnly) {
- this.path = path;
- this.readonly = readOnly;
- }
-
- public String getPath() {
- return path;
- }
-
- public boolean isReadonly() {
- return readonly;
- }
-}
Deleted: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSUIAction.java
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSUIAction.java 2008-04-15 09:06:30 UTC (rev 788)
+++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/VCSUIAction.java 2008-04-15 09:09:28 UTC (rev 789)
@@ -1,27 +0,0 @@
-package org.codelutin.vcs;
-
-import org.codelutin.vcs.VCSException;
-import org.codelutin.vcs.VCSHandler;
-import org.codelutin.vcs.VCSFileState;
-
-import javax.swing.JDialog;
-import java.util.List;
-
-/**
- * a IsisVCSUIAction represents an action to realize on a file in working copy
- * or on remote repository with an possible ui interaction.
- *
- * This is the highest api level for vcs using
- * <p/>
- * The method {@link #doAction(JDialog, org.codelutin.vcs.VCSHandler , List)} fired the action
- * on a list of states
- */
-public interface VCSUIAction {
- /**
- * @param dialog the dialog where action was asked
- * @param handler vcshandler to use
- * @param states list of VCSFileState to treate
- * @throws VCSException if any exception while operation
- */
- void doAction(JDialog dialog, VCSHandler handler,List<VCSFileState> states) throws VCSException;
-}
Deleted: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/package.html
===================================================================
--- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/package.html 2008-04-15 09:06:30 UTC (rev 788)
+++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/vcs/package.html 2008-04-15 09:09:28 UTC (rev 789)
@@ -1,11 +0,0 @@
-<html>
-<body>
-<h1>Lutin vcs</h1>
-Ensemble de l'api de base pour g�rer des Versionning Concurrent System (aka
-<code>vcs</code>) tel que CVS ou SVN.
-<br/>
-On retrouve ici des interfaces, des classes g�n�riques et les objets li�s aux vcs.
-<br/>
-Auncune impl�mentation n'est fournit actuellement ici.
-</body>
-</html>
\ No newline at end of file
1
0
[Lutinutil-commits] r788 - trunk/lutinutil/src/java/org/codelutin/vcs
by tchemit@users.labs.libre-entreprise.org 15 Apr '08
by tchemit@users.labs.libre-entreprise.org 15 Apr '08
15 Apr '08
Author: tchemit
Date: 2008-04-15 09:06:30 +0000 (Tue, 15 Apr 2008)
New Revision: 788
Modified:
trunk/lutinutil/src/java/org/codelutin/vcs/VCSHandler.java
Log:
ajout method pour reinit la connexion vcs
Modified: trunk/lutinutil/src/java/org/codelutin/vcs/VCSHandler.java
===================================================================
--- trunk/lutinutil/src/java/org/codelutin/vcs/VCSHandler.java 2008-04-15 09:05:08 UTC (rev 787)
+++ trunk/lutinutil/src/java/org/codelutin/vcs/VCSHandler.java 2008-04-15 09:06:30 UTC (rev 788)
@@ -37,7 +37,7 @@
/**
* TODO renommer en workingCopyRootFile
*
- * @return
+ * @return the locaqtion of working root directory
*/
File getLocalDatabasePath();
@@ -48,7 +48,14 @@
* @throws VCSException if any exception while init
*/
void initWorkingCopy() throws VCSException;
-
+ /**
+ * reinit working copy, says if it is the first we use it it, we will checkout
+ * the databaseDirectory directory
+ *
+ * @throws VCSException if any exception while init
+ */
+ void reinitWorkingCopy() throws VCSException;
+
/** delete the local working copy with all his files */
void deleteWorkingCopy();
1
0
[Lutinutil-commits] r787 - trunk/lutinutil/src/java/org/codelutin/util
by tchemit@users.labs.libre-entreprise.org 15 Apr '08
by tchemit@users.labs.libre-entreprise.org 15 Apr '08
15 Apr '08
Author: tchemit
Date: 2008-04-15 09:05:08 +0000 (Tue, 15 Apr 2008)
New Revision: 787
Modified:
trunk/lutinutil/src/java/org/codelutin/util/Resource.java
Log:
change log
Modified: trunk/lutinutil/src/java/org/codelutin/util/Resource.java
===================================================================
--- trunk/lutinutil/src/java/org/codelutin/util/Resource.java 2008-04-15 09:00:15 UTC (rev 786)
+++ trunk/lutinutil/src/java/org/codelutin/util/Resource.java 2008-04-15 09:05:08 UTC (rev 787)
@@ -293,7 +293,7 @@
// cas ou le ichier du classLoader est un fichier jar ou zip
if (file.exists() && (isJar(fileName) || isZip(fileName))) {
if (log.isDebugEnabled()) {
- log.info("jar to search " + file);
+ log.debug("jar to search " + file);
}
urlList.addAll(Resource.getURLsFromJar(file, pattern));
1
0