0 Replies Latest reply: Feb 28, 2007 2:54 AM by 564397 RSS

    CREATING SHARED FOLDER AND GRANTING USER PERMISSIONS USING ORACLE JAVAMAIL

    564397
      Hi:

      I hope that this is the right forum for this question.

      I downloaded a Java Script from Oracle for use with Oracle Collaboration suite. The only problem is that it doesn't work.

      The name of the class is SharedFolderCreate. Here is some code with my minor changes:

      Properties props = System.getProperties();
      String orclHome = System.getProperty("ORACLE_HOME");

      orclHome = "/u01/oracle/product/10.1.2/ocs_1/infra/";
      props.setProperty("oracle.mail.ldap.oracle_home",orclHome);

      Session session = Session.getDefaultInstance(props,null);
      session.setDebug(true);
      System.out.println("After setdebug");

      Store store = null;

      store = session.getStore("esmail");
      //store = session.getStore("imap");
      System.out.println("After getStore");

      if (user != null && password != null){
      store.connect(null, -1, user, password);
      //store.connect("localhost", -1, user, password);
      System.out.println("After Connection");

      // Open the folder - after store has connected
      Folder folder = store.getFolder(aSharedFolderName);

      if (!folder.exists()) {
      System.out.println("Folder does not exist");
      folder.create(Folder.HOLDS_MESSAGES);
      }
      System.out.println("Folder name : " + folder.getName());
      System.out.println("Creating Shared Folder");
      ((OracleFolder)folder).addACI(aSharedFolderUser, OracleACI.READACI);
      System.out.println("After addACI");
      ((OracleFolder)folder).modifyACI(aSharedFolderUser, OracleACI.READACI + OracleACI.WRITEACI);
      System.out.println("After modifyACI");
      System.out.println("Done Creating Shared Folder");
      }
      }
      }


      Here are my results:
      Exception in thread "main" javax.mail.NoSuchProviderException: No provider for esmail
      at javax.mail.Session.getProvider(Session.java:289)
      at javax.mail.Session.getStore(Session.java:363)
      at javax.mail.Session.getStore(Session.java:343)
      at SharedFolderCreateOrig.main(SharedFolderCreate.java:65)

      If I change esmail for imap I get an error further on:

      Folder name : shared
      Creating Shared Folder
      Exception in thread "main" java.lang.ClassCastException
      at SharedFolderCreate.main(SharedFolderCreate.java:83)

      which refers to the addACI call and recast to OracleFolder from folder.

      Thanks for your help.