Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

JSMTrace インターフェースを利用して、サービス・クラスを作成したプログラマーがトレース情報を書くことができます。

JSMTraceオブジェクトがnullではない場合、トレース・ファイルが存在するためそのファイルに書き込むことができます。

Stringテキストは、トレース・ファイルにUTF-8エンコードで書き込まれます。

printlnメソッドは、UTF-8エンコード・バイトの最後にCRLF (0x0D0x0A)を追加します。

String テキストに "\n" を埋め込むのではなく、print メソッドや println メソッドを使用することをお勧めします。


Code Block
public interface JSMTrace

...


{

...


  public void flush () ;

...


 

...


  public int getNumber () ;

...


 

...


  public File createTraceFile ( String fileName ) ;

...


 

...


  public void print ( String text ) ;

...


  public void println ( String text ) ;

...


 

...


  public void println ( Object object1, Object object2 ) ;

...


  public void println ( Object object1, Object object2, Object object3 ) ;

...


  public void println ( Object object1, Object object2, Object object3, Object object4  ;

...


  public void println ( Object object1, Object object2, Object object3, Object object4, Object object5 ) ;

...


  public void println ( Object object1, Object object2, Object object3, Object object4, Object object5, Object object6 ) ;

...


  public void println ( Object object1, Object object2, Object object3, Object object4, Object object5, Object object6, Object object7 ) ;

...


  public void println ( Object object1, Object object2, Object object3, Object object4, Object object5, Object object6, Object object7, Object object8 ) ;

...


 

...


  public void print ( Throwable throwable ) ;

...


  public void print ( JSMCommand command ) ;

...


  public void print ( JSMCommand command, JSMResponse response ) ;

...


  public void print ( JSMCommand command, Throwable throwable ) ;

...


}

 

...

Code Block
    public final void service ( JSMContainer container )
    {
        m_trace = container.getServiceTrace () ;
    }
 
    public final JSMResponse command ( JSMCommand command ) throws JSMException
    {
        try
        {
            if ( m_trace != null )
            {
                m_trace.print ( command ) ;

...


            }

...


 

...


            JSMResponse response = runCommand ( command ) ;

...


 

...


            if ( m_trace != null )

...


            {

...


                m_trace.print ( command, response ) ;

...


            }

...


 

...


            return response ;

...


        }

...


        catch ( Throwable t )

...


        {

...


            if ( m_trace != null )

...


            {

...


                m_trace.print ( command, t ) ;

...


            }

...


 

...


            return new JSMResponse ( t ) ;

...


        }

...


    }

...


 

...


    private final JSMResponse runCommand ( JSMCommand command ) throws Exception

...


    {

...


       if ( command.equals ( command.SERVICE_LOAD ) )

...


       {

...


           return new JSMResponse ( "Command has completed" ) ;

...


       }

...


    

...


       return new JSMResponse ( JSMResponse.ERROR, "Unknown command" ) ;

...


   }

...