示例#1
0
 public static synchronized PropertyList getProperties(MailboxURL url) {
   if (list == null) initialize();
   String name = url.getCanonicalName();
   for (int i = list.size() - 1; i >= 0; i--) {
     Entry entry = list.get(i);
     if (entry.name.equals(name)) return entry.properties;
   }
   return null;
 }
示例#2
0
 public static synchronized void saveProperties(MailboxBuffer mb) {
   MailboxURL url = mb.getUrl();
   if (url == null) {
     Debug.bug();
     return;
   }
   String name = url.getCanonicalName();
   if (name == null) {
     Debug.bug();
     return;
   }
   if (name.length() == 0) {
     Debug.bug();
     return;
   }
   PropertyList properties = mb.getProperties();
   if (properties == null || properties.size() == 0) {
     Log.debug("MailboxProperties.saveProperties no properties set");
     return;
   }
   if (list == null) initialize();
   Entry newEntry = new Entry(name, properties);
   final int limit = list.size();
   for (int i = 0; i < limit; i++) {
     Entry entry = list.get(i);
     if (entry.name.equals(name)) {
       if (i == 0) {
         list.set(0, newEntry);
         save();
         return;
       }
       list.remove(i);
       break;
     }
   }
   // Add new entry.
   list.add(0, newEntry);
   save();
 }