Changeset 241
- Timestamp:
- 03/17/10 16:16:06 (14 years ago)
- Location:
- VirtualCollectionRegistry/trunk/VirtualCollectionRegistry
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/pom.xml
r214 r241 209 209 <groupId>org.slf4j</groupId> 210 210 <artifactId>slf4j-jdk14</artifactId> 211 <version> 1.5.10</version>211 <version>${slf4j.version}</version> 212 212 <scope>runtime</scope> 213 213 </dependency> … … 216 216 <groupId>org.slf4j</groupId> 217 217 <artifactId>slf4j-api</artifactId> 218 <version>1.5.10</version> 219 <scope>runtime</scope> 218 <version>${slf4j.version}</version> 220 219 </dependency> 221 220 … … 235 234 <hibernate.version>3.5.0-CR-2</hibernate.version> 236 235 <hibernate.jpaVersion>1.0.0-CR-1</hibernate.jpaVersion> 236 <slf4j.version>1.5.11</slf4j.version> 237 237 </properties> 238 238 </project> -
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/DataStore.java
r217 r241 2 2 3 3 import java.util.Map; 4 import java.util.logging.Level;5 import java.util.logging.Logger;6 4 7 5 import javax.persistence.EntityManager; … … 9 7 import javax.persistence.EntityTransaction; 10 8 import javax.persistence.Persistence; 9 10 import org.slf4j.Logger; 11 import org.slf4j.LoggerFactory; 11 12 12 13 public class DataStore { … … 20 21 } // inner class ThreadLocalEntityManager 21 22 private static final Logger logger = 22 Logger .getLogger(DataStore.class.getName());23 LoggerFactory.getLogger(DataStore.class); 23 24 private final EntityManagerFactory emf; 24 25 private final ThreadLocalEntityManager em = new ThreadLocalEntityManager(); … … 30 31 "VirtualCollectionStore", config); 31 32 } catch (Exception e) { 32 logger. log(Level.SEVERE,"error initializing data store", e);33 logger.error("error initializing data store", e); 33 34 throw new VirtualCollectionRegistryException("error initializing", 34 35 e); 35 36 } 36 logger. finer("data store was successfully initialized");37 logger.debug("data store was successfully initialized"); 37 38 } 38 39 -
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/VirtualCollectionRegistry.java
r237 r241 6 6 import java.util.Map; 7 7 import java.util.concurrent.atomic.AtomicBoolean; 8 import java.util.logging.Level;9 import java.util.logging.Logger;10 8 11 9 import javax.persistence.EntityManager; 12 10 import javax.persistence.NoResultException; 13 11 import javax.persistence.TypedQuery; 12 13 import org.slf4j.Logger; 14 import org.slf4j.LoggerFactory; 14 15 15 16 import eu.clarin.cmdi.virtualcollectionregistry.model.InternalPersistentIdentifierProvider; … … 25 26 public class VirtualCollectionRegistry { 26 27 private static final Logger logger = 27 Logger .getLogger(VirtualCollectionRegistry.class.getName());28 LoggerFactory.getLogger(VirtualCollectionRegistry.class); 28 29 private static final VirtualCollectionRegistry s_instance = 29 30 new VirtualCollectionRegistry(); … … 47 48 throw new VirtualCollectionRegistryException("already initialized"); 48 49 } 49 logger. fine("initialize...");50 logger.debug("initializing virtual collection registry ..."); 50 51 if (config != null) { 51 52 config = Collections.unmodifiableMap(config); … … 57 58 this.marshaller = new VirtualCollectionRegistryMarshaller(); 58 59 this.intialized.set(true); 60 logger.info("virtual collection registry successfully intialized"); 59 61 } 60 62 … … 89 91 throw new NullPointerException("vc == null"); 90 92 } 93 94 logger.debug("creating virtual collection"); 91 95 92 96 VirtualCollectionValidator validator = … … 108 112 vc.setOwner(user); 109 113 vc.createUUID(); 110 em.persist(vc); 114 em.persist(vc); 111 115 em.getTransaction().commit(); 112 116 … … 116 120 em.persist(pid); 117 121 em.getTransaction().commit(); 118 122 logger.debug("created virtual collection (id={}, pid={})", 123 vc.getId(), pid.getIdentifier()); 119 124 return vc.getId(); 120 } catch (Exception e) { 121 logger.log(Level.SEVERE, 122 "error while creating virtual collection", e); 125 } catch (VirtualCollectionRegistryException e) { 126 logger.debug("failed creating virtual collecion: {}", 127 e.getMessage()); 128 throw e; 129 } catch (Exception e) { 130 logger.error("error while creating virtual collection", e); 123 131 throw new VirtualCollectionRegistryException( 124 132 "error while creating virtual collection", e); … … 137 145 throw new NullPointerException("vc == null"); 138 146 } 139 147 148 logger.debug("updating virtual collection (id={})", id); 149 140 150 VirtualCollectionValidator validator = 141 151 new VirtualCollectionValidator(); … … 157 167 validator.validate(c); 158 168 em.getTransaction().commit(); 169 logger.debug("updated virtual collection (id={})", vc.getId()); 159 170 return vc.getId(); 160 171 } catch (VirtualCollectionRegistryException e) { 172 logger.debug("failed updating virtual collecion (id={}): {}", 173 id, e.getMessage()); 161 174 throw e; 162 175 } catch (Exception e) { 163 logger.log(Level.SEVERE, 164 "error while updating virtual collection", e); 176 logger.error("error while updating virtual collection", e); 165 177 throw new VirtualCollectionRegistryException( 166 178 "error while updating virtual collection", e); … … 177 189 } 178 190 191 logger.debug("deleting virtual collection (id={})", id); 192 179 193 try { 180 194 EntityManager em = datastore.getEntityManager(); … … 182 196 VirtualCollection vc = em.find(VirtualCollection.class, new Long(id)); 183 197 if (vc == null) { 198 logger.debug("virtual collection (id={}) not found", id); 184 199 throw new VirtualCollectionNotFoundException(id); 185 200 } … … 193 208 return vc.getId(); 194 209 } catch (VirtualCollectionRegistryException e) { 210 logger.debug("failed deleting virtual collecion (id={}): {}", 211 id, e.getMessage()); 195 212 throw e; 196 213 } catch (Exception e) { 197 logger.log(Level.SEVERE, 198 "error while deleting virtual collection", e); 214 logger.error("error while deleting virtual collection", e); 199 215 throw new VirtualCollectionRegistryException( 200 216 "error while deleting virtual collection", e); … … 208 224 } 209 225 226 logger.debug("retrieve virtual collection (id={})", id); 227 210 228 try { 211 229 EntityManager em = datastore.getEntityManager(); … … 215 233 em.getTransaction().commit(); 216 234 if (vc == null) { 235 logger.debug("virtual collection (id={}) not found", id); 217 236 throw new VirtualCollectionNotFoundException(id); 218 237 } … … 221 240 throw e; 222 241 } catch (Exception e) { 223 logger.log(Level.SEVERE, 224 "error while retrieving virtual collection", e); 242 logger.error("error while retrieving virtual collection", e); 225 243 throw new VirtualCollectionRegistryException( 226 244 "error while retrieving virtual collection", e); … … 237 255 throw new IllegalArgumentException("uuid is empty"); 238 256 } 257 258 logger.debug("retrieve virtual collection (uuid={})", uuid); 239 259 240 260 try { … … 249 269 return vc; 250 270 } catch (NoResultException e) { 271 logger.debug("virtual collection (uuid={}) not found", uuid); 251 272 throw new VirtualCollectionNotFoundException(uuid); 252 273 } catch (Exception e) { 253 logger.log(Level.SEVERE, 254 "error while retrieving virtual collection", e); 274 logger.error("error while retrieving virtual collection", e); 255 275 throw new VirtualCollectionRegistryException( 256 276 "error while retrieving virtual collection", e); … … 297 317 "query invalid", e); 298 318 } catch (Exception e) { 299 logger.log(Level.SEVERE, 300 "error while enumerating virtual collections", e); 319 logger.error("error while enumerating virtual collections", e); 301 320 throw new VirtualCollectionRegistryException( 302 321 "error while enumerating virtual collections", e); … … 359 378 throw e; 360 379 } catch (Exception e) { 361 logger.log(Level.SEVERE, 362 "error while enumerating virtual collections", e); 380 logger.error("error while enumerating virtual collections", e); 363 381 throw new VirtualCollectionRegistryException( 364 382 "error while enumerating virtual collections", e); -
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/VirtualCollectionRegistryMarshaller.java
r239 r241 6 6 import java.net.URL; 7 7 import java.util.HashMap; 8 import java.util.logging.Level;9 import java.util.logging.Logger;10 8 11 9 import javax.xml.XMLConstants; … … 25 23 import org.codehaus.jettison.mapped.MappedXMLInputFactory; 26 24 import org.codehaus.jettison.mapped.MappedXMLOutputFactory; 25 import org.slf4j.Logger; 26 import org.slf4j.LoggerFactory; 27 27 28 28 import eu.clarin.cmdi.virtualcollectionregistry.model.ClarinVirtualCollection; … … 36 36 private static final String ENCODING = "UTF-8"; 37 37 private static final String VERSION = "1.0"; 38 private static final Logger logger = Logger39 .getLogger(VirtualCollectionRegistryMarshaller.class.getName());38 private static final Logger logger = 39 LoggerFactory.getLogger(VirtualCollectionRegistryMarshaller.class); 40 40 private Schema schema = null; 41 41 private XMLInputFactory xmlReaderFactory; … … 46 46 VirtualCollectionRegistryMarshaller() 47 47 throws VirtualCollectionRegistryException { 48 logger. fine("initializing schemas for marshaller ...");48 logger.debug("initializing schemas for marshaller ..."); 49 49 try { 50 50 SchemaFactory sf = SchemaFactory … … 63 63 jsonWriterFactory = new MappedXMLOutputFactory(mapping); 64 64 } catch (Exception e) { 65 logger. log(Level.SEVERE,"error initializing marshaller", e);65 logger.error("error initializing marshaller", e); 66 66 throw new VirtualCollectionRegistryException( 67 67 "error initializing marshaller", e); … … 85 85 writer.close(); 86 86 } catch (Exception e) { 87 logger 88 .log(Level.WARNING, "error marshalling virtual collection", e); 87 logger.error("error marshalling virtual collection", e); 89 88 throw new IOException("error marshalling virtual collection", e); 90 89 } … … 107 106 "virtual collection format", e.getLinkedException()); 108 107 } catch (Exception e) { 109 logger. log(Level.WARNING,"error unmarshalling virtual collection", e);108 logger.error("error unmarshalling virtual collection", e); 110 109 throw new IOException("error unmarshalling virtual collection", e); 111 110 } … … 139 138 writer.close(); 140 139 } catch (Exception e) { 141 logger. log(Level.WARNING,"error marshalling virtual collections", e);140 logger.error("error marshalling virtual collections", e); 142 141 throw new IOException("error marshalling virtual collections", e); 143 142 } … … 160 159 writer.close(); 161 160 } catch (Exception e) { 162 logger. log(Level.WARNING,"error marshalling clarin virtual collections", e);161 logger.error("error marshalling clarin virtual collections", e); 163 162 throw new IOException("error marshalling clarin virtual collections", e); 164 163 }
Note: See TracChangeset
for help on using the changeset viewer.