Customizing Publishing Queues
This section contains information and sample code for the filter classes used for publish.publishqueue.priorities.filtermethod and wvs.property publish.publishqueue.usesetworkers.filtermethod.
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 description to be set.
• [0] = priority H, M L
• [1] = queue set name which should have been configured 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 the property publish.publishqueue.priorities.filtermethod=com.ptc.wvs.server.publish.PTCWVSPublishFilters/publishqueueFiltermethod.
publish.publishqueue.usesetworkers.filtermethod
This method will be called when a conversion job is being submitted to the CADAgent. The representation name and description to be set to return the worker queue set, and the CADAgent it should use (if this job will be able to use a worker that has the queueset property that includes the return value). This does not have to be the same as the actual publishing queue set that is being used. For example, you could have dedicated worker for assemblies and parts from the same set.
Controlled by the property publish.publishqueue.usesetworkers.filtermethod=com.ptc.wvs.server.publish.MyPublishFilters/publishUsesetworkersFiltermethod.
Use Case
If there are no workers configured as dedicated workers, the system will pick any workers which are currently free and job will get published via that worker. The worker is not a dedicated worker, because no usesetworkers.filtermethod has been configured.
If you have only dedicated workers and if usesetworkers.filtermethod has not been defined, the result will be the error: “Error, did not find available worker of type PROE”.
If you want to send jobs via dedicated workers then you must write a UsesetworkersFiltermethod method. After that has been defined, the job will submit to the dedicated workers.
To do this:
1. xconfmanager -s publish.publishqueue.priorities.filtermethod=com.ptc.wvs.server.publish.PTCWVSPublishFilters/publishqueueFiltermethod -t codebase/WEB-INF/conf/wvs.properties -p
2. To compile the java file, run the following command in a windchill shell
a. set CLASSPATH = %CLASSPATH%; %WT_HOME%\srclib\tool\Annotations.jar
b. cd codebase\com\ptc\wvs\server\publish
c. javac PTCWVSPublishFilters.java
3. Restart Windchill.
Sample Code
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");
}
}
Sample Properties File
<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"/>
Compiling Java File
Based on where you deploy the java file.
1. set CLASSPATH = %CLASSPATH%; %WT_HOME%\srclib\tool\Annotations.jar
2. cd codebase\com\ptc\wvs\server\publish
3. javac PTCWVSPublishFilters.java