高度なカスタマイズ > ビジネスロジックのカスタマイズ > Windchill Visualization Services のカスタマイズ > パブリッシングキューのカスタマイズ
  
パブリッシングキューのカスタマイズ
このセクションには、publish.publishqueue.priorities.filtermethod および wvs.property publish.publishqueue.usesetworkers.filtermethod に使用されるフィルタクラスの情報とサンプルコードが掲載されています。
publish.publishqueue.priorities.filtermethod
パブリッシングジョブがサブミットされるとこのメソッドが呼び出され、優先度、キューセット名、製品表現名、説明を設定できます。
[0] = 優先度 H、M、L
[1] = publish.publishqueue.setnames によって設定されている必要があるキューセット名
[2] = 製品表現の新しい名前
[3] = 製品表現の新しい説明
戻り文字列のいずれかが null の場合、既存の値は変更されません。プロパティ publish.publishqueue.priorities.filtermethod=com.ptc.wvs.server.publish.PTCWVSPublishFilters/publishqueueFiltermethod によって制御されます。
publish.publishqueue.usesetworkers.filtermethod
このメソッドは変換ジョブが CADAgent にサブミットされているときに呼び出されます。Worker キューセットを返すために設定する必要がある製品表現の名前と説明、およびそのキューセットが使用する必要がある CADAgent (このジョブが、戻り値を含む queueset プロパティを持つ Worker を使用可能な場合)。これは使用されている実際のパブリッシングキューセットと同じである必要はありません。たとえば、同じセット内のアセンブリと部品に専用の Worker を持つことができます。
プロパティ publish.publishqueue.usesetworkers.filtermethod=com.ptc.wvs.server.publish.MyPublishFilters/publishUsesetworkersFiltermethod によって制御されます。
使用事例
専用 Worker として設定されている Worker がない場合、現在空いている任意の Worker が自動的に選択され、その Worker を介してジョブがパブリッシングされます。usesetworkers.filtermethod が設定されていないので、その Worker は専用 Worker ではありません。
専用 Worker だけがあり、usesetworkers.filtermethod が定義されていない場合、「エラー。タイプ PROE の使用可能な worker が見つかりませんでした。」というエラーが返ります。
専用 Worker を介してジョブを送信するには、メソッド UsesetworkersFiltermethod を記述する必要があります。これが定義された後は、ジョブが専用 Worker にサブミットされます。
そのためには、以下の手順に従います。
1. xconfmanager -s publish.publishqueue.priorities.filtermethod=com.ptc.wvs.server.publish.PTCWVSPublishFilters/publishqueueFiltermethod -t codebase/WEB-INF/conf/wvs.properties -p
2. Windchill シェルで次のコマンドを実行して Java ファイルをコンパイルします。
a. set CLASSPATH = %CLASSPATH%; %WT_HOME%\srclib\tool\Annotations.jar
b. cd codebase\com\ptc\wvs\server\publish
c. javac PTCWVSPublishFilters.java
3. Windchill を再起動します。
サンプルコード
package com.ptc.wvs.server.publish;
import wt.epm.EPMDocument;
import wt.fc.Persistable;
import wt.fc.QueryResult;
import wt.representation.Representation;
import java.io.File;
import java.util.Properties;
/**
* Example methods for the Dedicated Publisher Queue Set and Worker
* enhancement
*/
public class PTCWVSPublishFilters
{
/**
* publish.publishqueue.priorities.filtermethod
*
* This method is called when a publish job is being submitted and
* allows the priority, queue set and
* representation name and descrition to be set
* return [0] = priority H, M L
* [1] = queue set name which should have been confgured by
* "publish.publishqueue.setnames"
* [2] = new name for representation
* [3] = new description for representation
* Any of the return strings can be null, in which case the
* existing value is unchanged.
* Controlled by property
* publish.publishqueue.priorities.filtermethod=
* com.ptc.wvs.server.publish.
* PTCWVSPublishFilters/publishqueueFiltermethod
*
**/
public static String[] publishqueueFiltermethod(Persistable p,
Integer requestType, Integer requestSource,
String requestQueuePriority, String requestQueueSet,
String repName, String repDesc)
{
String[] ret = {null, null, null, null};

if( p instanceof EPMDocument ) {
EPMDocument epmdoc = (EPMDocument)p;
if( epmdoc.getAuthoringApplication().toString().toUpperCase().equals("PROE") )
{
if(epmdoc.getDocType().toString().equals("CADDRAWING")){
ret[0]="L";
}
if(epmdoc.getDocType().toString().equals("CADCOMPONENT")){
ret[0]="M";
}
if(epmdoc.getDocType().toString().equals("CADASSEMBLY")){
ret[0]="H";
}
if (epmdoc.getDocType().toString().equals("CADDRAWING")) {
ret[1]="PROEDRW";
}
if (epmdoc.getDocType().toString().equals("CADCOMPONENT")) {
ret[1]="PROEPRT";
}
if (epmdoc.getDocType().toString().equals("CADASSEMBLY")) {
ret[1]="PROEASM";
}
ret[2]="SITHIK_PROE_REP";
ret[3]="SITHIK_PROE_DESC";
}
System.out.println("publishqueueFiltermethod outputs:");
System.out.println(" Queue Set: " + ret[1]);
System.out.println(" Priority: " + ret[0]);
System.out.println(" RepName: " + ret[2]);
System.out.println(" RepDesc: " + ret[3]);
}
return ret;
}

/**
* publish.publishqueue.usesetworkers.filtermethod
*
* This method will be called when a conversion job is being
* submitted to the CADAgent representation name and description
* to be set return the worker queue set the the
* CADAGent should use, ie this job will be able to use a
* worker that has the "queueset" property that includes the
* return value. There is not reason that this has to be the
* same as the actual publsihing queue set that is being used,
* for example you could have dedicated worker for assemblies
* and parts from the same set.
* Controlled by property
* publish.publishqueue.usesetworkers.filtermethod=
* com.ptc.wvs.server.publish.MyPublishFilters/
* publishUsesetworkersFiltermethod
*
**/
public static String publishUsesetworkersFiltermethod(Persistable p,
String workerType,
String cadType, String fileName,
String requestQueuePriority,
String requestQueueSet)
{
System.out.println("publishqueueUsesetworkersFiltermethod : " + p + " " +
workerType + " " + cadType +
" " + fileName + " " + requestQueuePriority + " " + requestQueueSet);
String ret = "DEFAULT";
if( p instanceof EPMDocument ) {
EPMDocument epmdoc = (EPMDocument)p;
System.out.println( "Input docType: " + epmdoc.getDocType().toString() );
System.out.println( "Input AuthApp: " + epmdoc.getAuthoringApplication().toString().toUpperCase() );
if( epmdoc.getAuthoringApplication().toString().toUpperCase().equals("PROE") )
{
if (epmdoc.getDocType().toString().equals("CADDRAWING")) {
ret="PROEDRW";
}
if (epmdoc.getDocType().toString().equals("CADCOMPONENT")) {
ret="PROEPRT";
}
if (epmdoc.getDocType().toString().equals("CADASSEMBLY")) {
ret="PROEASM";
}
}
}
System.out.println("WorkerSet: " + ret);
return ret;
}

public static void main(String args[])
{
System.out.println("hook " + args[0]);
System.out.println("EXITSTATUS:1");
}
}
サンプルプロパティファイル
<Property name="publish.publishqueue.usesetworkers.forqueueset.PROEDRW"
overridable="true" targetfile="codebase/WEB-INF/conf/wvs.properties""
value="PROE"/>
<Property name="wt.queue.removeCompleted.PublisherQueuePROEDRW1"
overridable="true" targetFile="codebase/wt.properties" value="false"/>
<Property name="wt.queue.removeCompleted.PublisherQueuePROEDRW2"
overridable="true" targetFile="codebase/wt.properties" value="false"/>
<AddToProperty name="publish.publishqueue.setnames" value="PROEDRW"/>
<Property name="publish.publishqueue.usesetworkers.forqueueset.PROEASM"
overridable="true" targetfile="codebase/WEB-INF/conf/wvs.properties""
value="PROE"/>
<Property name="wt.queue.removeCompleted.PublisherQueuePROEASM1"
overridable="true" targetFile="codebase/wt.properties" value="false"/>
<Property name="wt.queue.removeCompleted.PublisherQueuePROEASM2"
overridable="true" targetFile="codebase/wt.properties" value="false"/>
<AddToProperty name="publish.publishqueue.setnames" value="PROEASM"/>
<Property name="publish.publishqueue.usesetworkers.forqueueset.PROEPRT"
overridable="true" targetfile="codebase/WEB-INF/conf/wvs.properties""
value="PROE"/>
<Property name="wt.queue.removeCompleted.PublisherQueuePROEPRT1"
overridable="true" targetFile="codebase/wt.properties" value="false"/>
<Property name="wt.queue.removeCompleted.PublisherQueuePROEPRT2"
overridable="true" targetFile="codebase/wt.properties" value="false"/>
<AddToProperty name="publish.publishqueue.setnames" value="PROEPRT"/>

<Property name="publish.publishqueue.priorities.filtermethod"
overridable="true"
targetfile="codebase/WEB-INF/conf/wvs.properties""
value="com.ptc.wvs.server.publish.PTCWVSPublishFilters/
publishqueueFiltermethod"/>
<Property name="publish.publishqueue.usesetworkers.filtermethod"
overridable="true"
targetfile="codebase/WEB-INF/conf/wvs.properties""
value="com.ptc.wvs.server.publish.
PTCWVSPublishFilters/publishUsesetworkersFiltermethod"/>

<Property name="wt.queue.max.processQueues"
overridable="true"
targetFile="codebase/wt.properties" value="60"/>
Java ファイルのコンパイル
Java ファイルを配置する場所によります。
1. set CLASSPATH = %CLASSPATH%; %WT_HOME%\srclib\tool\Annotations.jar
2. cd codebase\com\ptc\wvs\server\publish
3. javac PTCWVSPublishFilters.java