View Javadoc
1 /* 2 * $Header: /cvsroot/ebxmlrr/ebxmlrr/src/share/com/sun/ebxml/registry/repository/AbstractRepositoryManager.java,v 1.1 2002/11/09 22:47:58 peteburg Exp $ 3 */ 4 package com.sun.ebxml.registry.repository; 5 6 import java.io.*; 7 import java.util.*; 8 9 import org.apache.commons.logging.*; 10 import org.apache.xml.security.signature.*; 11 import org.apache.xml.serialize.*; 12 13 import com.sun.ebxml.registry.*; 14 import com.sun.ebxml.registry.util.*; 15 16 /*** 17 * Abstract class implementing RepositoryManager interface that can be 18 * extended by RepositoryManagers that control inserting, updating and 19 * deleting repository items. Provides minimal implementation of some 20 * generic methods. 21 * 22 * @author Adrian Chong 23 * @author Peter Burgess 24 * 25 * @version $Version: $ [$Date: 2002/11/09 22:47:58 $] 26 */ 27 public abstract class AbstractRepositoryManager implements RepositoryManager { 28 29 private org.apache.commons.logging.Log log = 30 LogFactory.getLog(this.getClass()); 31 32 33 /*** 34 * Delete multiple repository items. 35 * @param ids ArrayList of repositoryItem ids. 36 * @throws RegistryException if any of the item do not exist 37 */ 38 public void delete(ArrayList ids) throws RegistryException 39 { 40 Iterator iter = ids.iterator(); 41 while(iter.hasNext()) { 42 delete((String) iter.next()); 43 } 44 } 45 46 /*** 47 * Updates a RepositoryItem. 48 * @param item repository item to be updated. 49 * @exception RegistryException 50 */ 51 public void update(RepositoryItem item) throws RegistryException 52 { 53 System.out.println("[FileSystemRepositoryManager::update()] item.getId() = " + item.getId()); 54 55 String id = item.getId(); 56 delete(id); 57 insert(item); 58 } 59 60 /*** 61 * Get the total size an ArrayList of repository item in bytes. 62 * @param ids ArrayList of repository item ids 63 * @return 0 if the no items (or items do not exist). 64 */ 65 public long getItemsSize(ArrayList ids) throws RegistryException 66 { 67 if(ids.size()==0) { 68 return 0; 69 } 70 long totalSize = 0; 71 Iterator iter = ids.iterator(); 72 while(iter.hasNext()) { 73 String id = (String)iter.next(); 74 totalSize += getItemSize(id); 75 } 76 77 if(log.isTraceEnabled()) { 78 log.trace("[RepositoryManager:getItemsSize()] totalSize = " + totalSize); 79 } 80 81 return totalSize; 82 } 83 84 }

This page was automatically generated by Maven