On Mon, 2002-06-10 at 17:36, Serge Knystautas wrote:
> Yes, this is a known problem with an underlying library we're using 
> (Avalon.cornerstone).  If you have a patch that corrects it, I'd love to 
> see it.
The hack (I would not call it a patch, since this does not really solves
james problems...): 


in avalon.(etc)masterstore.RepositoryManager

    public static final String getName()
    {
      //  return REPOSITORY_NAME + id++; (who knows why this was
supposed to work?!
        return REPOSITORY_NAME +1;
    }

And then to retrieve your orphaned mail, run this in very user
directory:

java SetRepositoryNum -num 1

/*
 * SetRepositoryNum.java
 *
 * Created on June 9, 2002, 5:32 PM
 */
import java.io.*;
/**
 *
 * @author  kobus
 */
public class SetRepositoryNum
{
    String dirStr = ".";
    int num;
    
    /** Creates a new instance of SetRepositoryNum */
    public SetRepositoryNum (String args[])
    {
        if (args.length < 2)
        {
            printUsage();
            return;
        }
        
        
        if (args[0].equals ("-num"))
        {
            num = Integer.parseInt (args[1]);
        }
        
        if (args.length == 4)
        {
            if (args[2].equals ("-dir"))
            {
                dirStr = args[3];
            }
            else
            {
                printUsage();
                return;
            }
        }
        
        System.out.println("Setting repository number to "+num+" for
repository dir "+dirStr);
        
        File dir = new File(dirStr);
        if (!dir.exists ())
        {
            System.out.println("Directory "+dirStr+" does not exist");
            System.exit (1);
        }
        
        File files[] =dir.listFiles ();
        int idxofn,idxoff;
        int objectStoreNum = num;
        String rnum;
        StringBuffer sbuf;
        for (int i = 0;i < files.length;i++)
        {
            if (files[i].getName ().endsWith ("StreamStore"))
            {
                sbuf = new StringBuffer(files[i].getName
());                
                idxofn = files[i].getName ().indexOf ("Repository") +10;
                idxoff = files[i].getName ().indexOf (".F",idxofn);
                sbuf.replace (idxofn,idxoff,Integer.toString (num));
                //rnum = files[i].getName ().substring (idxofn,idxoff);
                files[i].renameTo (new File(files[i].getParent
(),sbuf.toString ()));
                //System.out.println("rnum:"+sbuf);                
            }
            else if (files[i].getName ().endsWith ("ObjectStore"))
            {
                sbuf = new StringBuffer(files[i].getName
());                
                idxofn = files[i].getName ().indexOf ("Repository") +10;
                idxoff = files[i].getName ().indexOf (".F",idxofn);
                sbuf.replace (idxofn,idxoff,Integer.toString
(objectStoreNum));
                //rnum = files[i].getName ().substring (idxofn,idxoff);
                files[i].renameTo (new File(files[i].getParent
(),sbuf.toString ()));
            }
        }
    }

    void printUsage()
    {
        System.out.println("setrepository -dir maildir -num num");
    }
    /**
     * @param args the command line arguments
     */
    public static void main (String[] args)
    {
        new SetRepositoryNum(args);
    }
    
}



> 
> -- 
> Serge Knystautas
> Loki Technologies - Unstoppable Websites
> http://www.lokitech.com
> 
> 
> Kobus Grobler wrote:
> > I spent the whole of yesterday trying to fix exactly the same problem.
> > It seems that everytime you restart James, the file store implementation
> > of james starts a new repository. You will notice files like
> > xxxxx.RepositoryYY.FileStreamStore etc. in the mailboxes.
> > This means that if you restart james when their is still mail in the
> > your mailbox, it will be orphaned because this repository number
> > changes  :<.
> > 
> > My solution to the problem was a bit of a hack on the source code (in
> > the Avalon AbstractFileStore)to get it fixed.
> > But I guess it would be best if you send a mail to the james dev-team.
> > 
> > 
> > On Mon, 2002-06-10 at 10:34, YILMAZ GULERYUZ wrote:
> > 
> >>Yes. exactly.
> >>I copied var folder etc. 
> >>But when I try to retrieve mails from any of the
> >>accounts usin outlook etc, there seems to be no emails
> >>in the box. Also trying to retrieve emails using
> >>webmail program on the same server, again all inboxes
> >>seems to be empty.
> >>
> >>Is there any change with the file formats?
> >>
> >>thanks in advance
> >>yilmaz
> >>http://java.ankanet.com.tr
> >>
> >>
> >>--- mohan <[EMAIL PROTECTED]> wrote:
> >>
> >>>Hi,
> >>>Did u try copying the "var" folder into the new
> >>>installation ? I feel it should work if you copy
> >>>that
> >>>as it contains all the user accoutnts, mailboxes,
> >>>spool, outbox etc.
> >>>Please revert back.
> >>>Mohan
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 
-- 
Kobus Grobler
CSO
Attix5 Ltd
www.attix5.com
[EMAIL PROTECTED]
+27 21 880 2323 (Tel)
+27 21 880 2324 (Fax)


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to