0

独自の Java コードを Notes レプリケーターに追加しています (アクティビティの同期など):

<plugin>
   <extension
     point="com.ibm.notes.client.notesSync">
     <unit
        class="com.ibm.notes.smartfile.RunOnReplication"
        id="com.ibm.notes.smartfile.RunOnReplication"
        image="icons/SmartFile.gif"
        label="IBM SmartFile action">
     </unit>
  </extension>
</plugin>

これにより、ジョブが実行されるたびに実行されるレプリケーター ページにエントリが追加されます。私のクラスは次のようになります。

public class RunOnReplication extends Job {
    public RunOnReplication(String name) {
      super(name);
    }

    @Override
    public IStatus run(IProgressMonitor arg0) {
        NotesSessionJob nsj = new NotesSessionJob("SmartFile Replication") {
            @Override
            protected IStatus runInNotesThread(Session s,
                IProgressMonitor monitor) throws NotesException {
            Engine engine = Activator.getDefault().getEngine();
            return engine.scheduledProcessing(s, monitor);
            }
        };
    nsj.schedule();
    return Status.OK_STATUS;
   }
}

今、私は疑問に思います: どうすればnsjジョブ内のモニターにステータスを外部クラスに報告させ、進行状況をレプリケーターの進行状況バーに報告させることができますか? または、新しいジョブを作成せずに NotesSession にアクセスする別の方法がありますか? ?

4

1 に答える 1

3

NotesSessionJob を使用する必要はありません。その代わりに、N/D Java クラスをインスタンス化する「古い」方法を使用することもできます。

public class RunOnReplication extends Job {
    public RunOnReplication(String name) {
      super(name);
    }

    @Override
    public IStatus run(IProgressMonitor arg0) {
        try {
            NotesThread.sinitThread();
            Session session = NotesFactory.createSessionWithFullAccess();
            //do your stuff here
        } catch (Exception e) {
            // do your error handling here
        } finally {
            NotesThread.stermThread();
        }
    return Status.OK_STATUS;
   }
}

ところで:クールなアイデア...

于 2012-09-28T06:03:00.763 に答える