commit
060d78a68f
@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="lib" path="lib/bcprov-ext-jdk15on-1.54.jar"/>
|
||||
<classpathentry kind="lib" path="lib/bcprov-jdk15on-1.54.jar"/>
|
||||
<classpathentry kind="lib" path="lib/commons-beanutils-1.7.0.jar"/>
|
||||
<classpathentry kind="lib" path="lib/commons-codec.jar"/>
|
||||
<classpathentry kind="lib" path="lib/commons-collections-3.1.jar"/>
|
||||
<classpathentry kind="lib" path="lib/commons-httpclient-3.1.jar"/>
|
||||
<classpathentry kind="lib" path="lib/commons-lang-2.5.jar"/>
|
||||
<classpathentry kind="lib" path="lib/commons-lang3-3.1.jar"/>
|
||||
<classpathentry kind="lib" path="lib/commons-logging.jar"/>
|
||||
<classpathentry kind="lib" path="lib/commons-net-3.6.jar"/>
|
||||
<classpathentry kind="lib" path="lib/ezmorph-1.0.3.jar"/>
|
||||
<classpathentry kind="lib" path="lib/fastjson-1.2.23.jar"/>
|
||||
<classpathentry kind="lib" path="lib/fccclient.jar"/>
|
||||
<classpathentry kind="lib" path="lib/fccjavaclientproxy.jar"/>
|
||||
<classpathentry kind="lib" path="lib/fmsclientcache.jar"/>
|
||||
<classpathentry kind="lib" path="lib/fmsservercache.jar"/>
|
||||
<classpathentry kind="lib" path="lib/fmsutil.jar"/>
|
||||
<classpathentry kind="lib" path="lib/fscclient.jar"/>
|
||||
<classpathentry kind="lib" path="lib/fscjavaclientproxy.jar"/>
|
||||
<classpathentry kind="lib" path="lib/gson-2.8.0.jar"/>
|
||||
<classpathentry kind="lib" path="lib/httpclient-4.5.jar"/>
|
||||
<classpathentry kind="lib" path="lib/httpcore-4.4.1.jar"/>
|
||||
<classpathentry kind="lib" path="lib/iText-5.0.3.jar"/>
|
||||
<classpathentry kind="lib" path="lib/itextpdf-5.5.11.jar"/>
|
||||
<classpathentry kind="lib" path="lib/jacob.jar"/>
|
||||
<classpathentry kind="lib" path="lib/javax.servlet-api-3.1.0.jar"/>
|
||||
<classpathentry kind="lib" path="lib/json-lib-2.1-jdk15.jar"/>
|
||||
<classpathentry kind="lib" path="lib/log4j-api-2.13.0.jar"/>
|
||||
<classpathentry kind="lib" path="lib/log4j-core-2.13.0.jar"/>
|
||||
<classpathentry kind="lib" path="lib/log4j-slf4j-impl-2.10.0.jar"/>
|
||||
<classpathentry kind="lib" path="lib/log4j.jar"/>
|
||||
<classpathentry kind="lib" path="lib/slf4j-api-1.7.26.jar"/>
|
||||
<classpathentry kind="lib" path="lib/TcSoaAdministrationLoose_13000.1.0.jar"/>
|
||||
<classpathentry kind="lib" path="lib/TcSoaCadStrong-12.3.0.jar"/>
|
||||
<classpathentry kind="lib" path="lib/TcSoaCommon_13000.1.0.jar"/>
|
||||
<classpathentry kind="lib" path="lib/TcSoaCommon-12.3.0.jar"/>
|
||||
<classpathentry kind="lib" path="lib/TcSoaCoreStrong_13000.1.0.jar"/>
|
||||
<classpathentry kind="lib" path="lib/TcSoaCoreStrong-12.3.0.jar"/>
|
||||
<classpathentry kind="lib" path="lib/TcSoaCoreTypes_13000.1.0.jar"/>
|
||||
<classpathentry kind="lib" path="lib/TcSoaManufacturingStrong_13000.1.0.jar"/>
|
||||
<classpathentry kind="lib" path="lib/TcSoaQueryStrong_13000.1.0.jar"/>
|
||||
<classpathentry kind="lib" path="lib/TcSoaQueryStrong-12.3.0.jar"/>
|
||||
<classpathentry kind="lib" path="lib/TcSoaReportsStrong_13000.1.0.jar"/>
|
||||
<classpathentry kind="lib" path="lib/TcSoaStrongModel_13000.1.0.jar"/>
|
||||
<classpathentry kind="lib" path="lib/TcSoaStrongModel-12.3.0.jar"/>
|
||||
<classpathentry kind="lib" path="lib/TcSoaWorkflowStrong_13000.1.0.jar"/>
|
||||
<classpathentry kind="lib" path="lib/TcSoaWorkflowStrong-12.3.0.jar"/>
|
||||
<classpathentry kind="lib" path="lib/test.jar"/>
|
||||
<classpathentry kind="lib" path="lib/tika-core-1.16.jar"/>
|
||||
<classpathentry kind="lib" path="lib/tika-parsers-1.16.jar"/>
|
||||
<classpathentry kind="lib" path="lib/xercesImpl.jar"/>
|
||||
<classpathentry kind="lib" path="lib/xml-apis.jar"/>
|
||||
<classpathentry kind="lib" path="poiLib/log4j-1.2.15.jar"/>
|
||||
<classpathentry kind="lib" path="poiLib/poi-3.17.jar"/>
|
||||
<classpathentry kind="lib" path="poiLib/poi-examples-3.17.jar"/>
|
||||
<classpathentry kind="lib" path="poiLib/poi-excelant-3.17.jar"/>
|
||||
<classpathentry kind="lib" path="poiLib/poi-ooxml-3.17.jar"/>
|
||||
<classpathentry kind="lib" path="poiLib/poi-ooxml-schemas-3.17.jar"/>
|
||||
<classpathentry kind="lib" path="poiLib/poi-scratchpad-3.17.jar"/>
|
||||
<classpathentry kind="lib" path="poiLib/xmlbeans-2.6.0.jar"/>
|
||||
<classpathentry kind="lib" path="lib/TcSoaClient_11000.2.0.jar"/>
|
||||
<classpathentry kind="lib" path="lib/org.apache.commons.httpclient_3.1.0.v201012070820.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>ZF_update_item</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding//src/com/zf/Main.java=UTF-8
|
||||
@ -0,0 +1,11 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,39 @@
|
||||
log4j.rootLogger=info,stdout,infolog,warnlog,errorlog,successlog
|
||||
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.Target=System.out
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n
|
||||
|
||||
log4j.appender.infolog = org.apache.log4j.DailyRollingFileAppender
|
||||
log4j.appender.infolog.Threshold = INFO
|
||||
log4j.appender.infolog.File = soalog/item_id/zf_update_itemid_all.log
|
||||
log4j.appender.infolog.layout = org.apache.log4j.PatternLayout
|
||||
log4j.appender.infolog.layout.ConversionPattern = [%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n
|
||||
#log4j.appender.infolog.filter.infoFilter = org.apache.log4j.varia.LevelRangeFilter
|
||||
#log4j.appender.infolog.filter.infoFilter.LevelMin = INFO
|
||||
#log4j.appender.infolog.filter.infoFilter.LevelMax = INFO
|
||||
|
||||
log4j.appender.warnlog = org.apache.log4j.DailyRollingFileAppender
|
||||
log4j.appender.warnlog.Threshold = WARN
|
||||
log4j.appender.warnlog.File = soalog/item_id/zf_update_itemid_warn.log
|
||||
log4j.appender.warnlog.layout = org.apache.log4j.PatternLayout
|
||||
log4j.appender.warnlog.layout.ConversionPattern = [%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n
|
||||
#log4j.appender.warnlog.filter.warnFilter = org.apache.log4j.varia.LevelRangeFilter
|
||||
#log4j.appender.warnlog.filter.warnFilter.LevelMin = WARN
|
||||
#log4j.appender.warnlog.filter.warnFilter.LevelMax=WARN
|
||||
|
||||
log4j.appender.errorlog = org.apache.log4j.DailyRollingFileAppender
|
||||
log4j.appender.errorlog.Threshold = ERROR
|
||||
log4j.appender.errorlog.File = soalog/item_id/zf_update_itemid_error.log
|
||||
log4j.appender.errorlog.layout = org.apache.log4j.PatternLayout
|
||||
log4j.appender.errorlog.layout.ConversionPattern = [%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n
|
||||
log4j.appender.errorlog.filter.warnFilter = org.apache.log4j.varia.LevelRangeFilter
|
||||
log4j.appender.errorlog.filter.warnFilter.LevelMin = ERROR
|
||||
log4j.appender.errorlog.filter.warnFilter.LevelMax=ERROR
|
||||
|
||||
log4j.appender.successlog = org.apache.log4j.DailyRollingFileAppender
|
||||
log4j.appender.successlog.Threshold = FATAL
|
||||
log4j.appender.successlog.File = soalog/item_id/zf_update_itemid_success.log
|
||||
log4j.appender.successlog.layout = org.apache.log4j.PatternLayout
|
||||
log4j.appender.successlog.layout.ConversionPattern = [%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n
|
||||
Binary file not shown.
Binary file not shown.
@ -0,0 +1,15 @@
|
||||
#host=http://192.168.9.20:7001/tc
|
||||
#username=admin
|
||||
#password=admin
|
||||
#host=http://10.19.245.251:58001/tc
|
||||
#username=ojplm
|
||||
#password=hand@123
|
||||
host=http://10.10.2.40:7001/tc
|
||||
username=dcproxy
|
||||
password=dcproxy
|
||||
group=dba
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
@ -0,0 +1,39 @@
|
||||
log4j.rootLogger=info,stdout,infolog,warnlog,errorlog,successlog
|
||||
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.Target=System.out
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n
|
||||
|
||||
log4j.appender.infolog = org.apache.log4j.DailyRollingFileAppender
|
||||
log4j.appender.infolog.Threshold = INFO
|
||||
log4j.appender.infolog.File = soalog/item_id/Hisense_update_itemid_all.log
|
||||
log4j.appender.infolog.layout = org.apache.log4j.PatternLayout
|
||||
log4j.appender.infolog.layout.ConversionPattern = [%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n
|
||||
#log4j.appender.infolog.filter.infoFilter = org.apache.log4j.varia.LevelRangeFilter
|
||||
#log4j.appender.infolog.filter.infoFilter.LevelMin = INFO
|
||||
#log4j.appender.infolog.filter.infoFilter.LevelMax = INFO
|
||||
|
||||
log4j.appender.warnlog = org.apache.log4j.DailyRollingFileAppender
|
||||
log4j.appender.warnlog.Threshold = WARN
|
||||
log4j.appender.warnlog.File = soalog/item_id/Hisense_update_itemid_warn.log
|
||||
log4j.appender.warnlog.layout = org.apache.log4j.PatternLayout
|
||||
log4j.appender.warnlog.layout.ConversionPattern = [%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n
|
||||
#log4j.appender.warnlog.filter.warnFilter = org.apache.log4j.varia.LevelRangeFilter
|
||||
#log4j.appender.warnlog.filter.warnFilter.LevelMin = WARN
|
||||
#log4j.appender.warnlog.filter.warnFilter.LevelMax=WARN
|
||||
|
||||
log4j.appender.errorlog = org.apache.log4j.DailyRollingFileAppender
|
||||
log4j.appender.errorlog.Threshold = ERROR
|
||||
log4j.appender.errorlog.File = soalog/item_id/Hisense_update_itemid_error.log
|
||||
log4j.appender.errorlog.layout = org.apache.log4j.PatternLayout
|
||||
log4j.appender.errorlog.layout.ConversionPattern = [%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n
|
||||
log4j.appender.errorlog.filter.warnFilter = org.apache.log4j.varia.LevelRangeFilter
|
||||
log4j.appender.errorlog.filter.warnFilter.LevelMin = ERROR
|
||||
log4j.appender.errorlog.filter.warnFilter.LevelMax=ERROR
|
||||
|
||||
log4j.appender.successlog = org.apache.log4j.DailyRollingFileAppender
|
||||
log4j.appender.successlog.Threshold = FATAL
|
||||
log4j.appender.successlog.File = soalog/item_id/Hisense_update_itemid_success.log
|
||||
log4j.appender.successlog.layout = org.apache.log4j.PatternLayout
|
||||
log4j.appender.successlog.layout.ConversionPattern = [%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n
|
||||
@ -0,0 +1,15 @@
|
||||
#host=http://192.168.9.20:7001/tc
|
||||
#username=admin
|
||||
#password=admin
|
||||
#host=http://10.19.245.251:58001/tc
|
||||
#username=ojplm
|
||||
#password=hand@123
|
||||
host=http://10.10.2.40:7001/tc
|
||||
username=dcproxy
|
||||
password=dcproxy
|
||||
group=dba
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,143 @@
|
||||
//==================================================
|
||||
//
|
||||
// Copyright 2010 Siemens Product Lifecycle Management Software Inc. All Rights Reserved.
|
||||
//
|
||||
//==================================================
|
||||
|
||||
package com.zf;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.LineNumberReader;
|
||||
|
||||
import com.teamcenter.schemas.soa._2006_03.exceptions.InvalidCredentialsException;
|
||||
import com.teamcenter.schemas.soa._2006_03.exceptions.InvalidUserException;
|
||||
import com.teamcenter.soa.client.CredentialManager;
|
||||
import com.teamcenter.soa.exceptions.CanceledOperationException;
|
||||
|
||||
/**
|
||||
* The CredentialManager is used by the Teamcenter Services framework to get the
|
||||
* user's credentials when challanged by the server. This can occur after a period
|
||||
* of inactivity and the server has timed-out the user's session, at which time
|
||||
* the client application will need to re-authenitcate. The framework will
|
||||
* call one of the getCredentials methods (depending on circumstances) and will
|
||||
* send the SessionService.login service request. Upon successfull completion of
|
||||
* the login service request. The last service request (one that cuased the challange)
|
||||
* will be resent.
|
||||
*
|
||||
* The framework will also call the setUserPassword setGroupRole methods when ever
|
||||
* these credentials change, thus allowing this implementation of the CredentialManager
|
||||
* to cache these values so prompting of the user is not requried for re-authentication.
|
||||
*
|
||||
*/
|
||||
public class AppXCredentialManager implements CredentialManager
|
||||
{
|
||||
|
||||
private String name = null;
|
||||
private String password = null;
|
||||
private String group = ""; // default group
|
||||
private String role = ""; // default role
|
||||
private String discriminator = "SoaAppX"; // always connect same user
|
||||
// to same instance of server
|
||||
|
||||
/**
|
||||
* Return the type of credentials this implementation provides,
|
||||
* standard (user/password) or Single-Sign-On. In this case
|
||||
* Standard credentials are returned.
|
||||
*
|
||||
* @see com.teamcenter.soa.client.CredentialManager#getCredentialType()
|
||||
*/
|
||||
public int getCredentialType()
|
||||
{
|
||||
return CredentialManager.CLIENT_CREDENTIAL_TYPE_STD;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prompt's the user for credentials.
|
||||
* This method will only be called by the framework when a login attempt has
|
||||
* failed.
|
||||
*
|
||||
* @see com.teamcenter.soa.client.CredentialManager#getCredentials(com.teamcenter.schemas.soa._2006_03.exceptions.InvalidCredentialsException)
|
||||
*/
|
||||
public String[] getCredentials(InvalidCredentialsException e)
|
||||
throws CanceledOperationException
|
||||
{
|
||||
System.out.println(e.getMessage());
|
||||
return promptForCredentials();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the cached credentials.
|
||||
* This method will be called when a service request is sent without a valid
|
||||
* session ( session has expired on the server).
|
||||
*
|
||||
* @see com.teamcenter.soa.client.CredentialManager#getCredentials(com.teamcenter.schemas.soa._2006_03.exceptions.InvalidUserException)
|
||||
*/
|
||||
public String[] getCredentials(InvalidUserException e)
|
||||
throws CanceledOperationException
|
||||
{
|
||||
// Have not logged in yet, shoult not happen but just in case
|
||||
if (name == null) return promptForCredentials();
|
||||
|
||||
// Return cached credentials
|
||||
String[] tokens = { name, password, group, role, discriminator };
|
||||
return tokens;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache the group and role
|
||||
* This is called after the SessionService.setSessionGroupMember service
|
||||
* operation is called.
|
||||
*
|
||||
* @see com.teamcenter.soa.client.CredentialManager#setGroupRole(java.lang.String,
|
||||
* java.lang.String)
|
||||
*/
|
||||
public void setGroupRole(String group, String role)
|
||||
{
|
||||
this.group = group;
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache the User and Password
|
||||
* This is called after the SessionService.login service operation is called.
|
||||
*
|
||||
* @see com.teamcenter.soa.client.CredentialManager#setUserPassword(java.lang.String,
|
||||
* java.lang.String, java.lang.String)
|
||||
*/
|
||||
public void setUserPassword(String user, String password, String discriminator)
|
||||
{
|
||||
this.name = user;
|
||||
this.password = password;
|
||||
this.discriminator = discriminator;
|
||||
}
|
||||
|
||||
|
||||
public String[] promptForCredentials()
|
||||
throws CanceledOperationException
|
||||
{
|
||||
try
|
||||
{
|
||||
LineNumberReader reader = new LineNumberReader(new InputStreamReader(System.in));
|
||||
System.out.println("Please enter user credentials (return to quit):");
|
||||
System.out.print("User Name: ");
|
||||
name = reader.readLine();
|
||||
|
||||
if (name.length() == 0)
|
||||
throw new CanceledOperationException("");
|
||||
|
||||
System.out.print("Password: ");
|
||||
password = reader.readLine();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
String message = "Failed to get the name and password.\n" + e.getMessage();
|
||||
System.out.println(message);
|
||||
throw new CanceledOperationException(message);
|
||||
}
|
||||
|
||||
String[] tokens = { name, password, group, role, discriminator };
|
||||
return tokens;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
//==================================================
|
||||
//
|
||||
// Copyright 2010 Siemens Product Lifecycle Management Software Inc. All Rights Reserved.
|
||||
//
|
||||
//==================================================
|
||||
|
||||
|
||||
package com.zf;
|
||||
|
||||
import com.teamcenter.soa.client.model.DeleteListener;
|
||||
|
||||
/**
|
||||
* Implementation of the DeleteListener, simply prints out list of all objects
|
||||
* that are deleted.
|
||||
*
|
||||
*/
|
||||
public class AppXDeletedObjectListener implements DeleteListener
|
||||
{
|
||||
|
||||
public void modelObjectDelete(String[] uids)
|
||||
{
|
||||
if (uids.length == 0)
|
||||
return;
|
||||
|
||||
System.out.println("");
|
||||
System.out.println("Deleted Objects handled in com.teamcenter.clientx.AppXDeletedObjectListener.modelObjectDelete");
|
||||
System.out.println("The following objects have been deleted from the server and removed from the client data model:");
|
||||
for (int i = 0; i < uids.length; i++)
|
||||
{
|
||||
System.out.println(" " + uids[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,102 @@
|
||||
//==================================================
|
||||
//
|
||||
// Copyright 2010 Siemens Product Lifecycle Management Software Inc. All Rights Reserved.
|
||||
//
|
||||
//==================================================
|
||||
|
||||
package com.zf;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.LineNumberReader;
|
||||
|
||||
import com.teamcenter.schemas.soa._2006_03.exceptions.ConnectionException;
|
||||
import com.teamcenter.schemas.soa._2006_03.exceptions.InternalServerException;
|
||||
import com.teamcenter.schemas.soa._2006_03.exceptions.ProtocolException;
|
||||
import com.teamcenter.soa.client.ExceptionHandler;
|
||||
import com.teamcenter.soa.exceptions.CanceledOperationException;
|
||||
|
||||
/**
|
||||
* Implementation of the ExceptionHandler. For ConnectionExceptions (server
|
||||
* temporarily down .etc) prompts the user to retry the last request. For other
|
||||
* exceptions convert to a RunTime exception.
|
||||
*/
|
||||
public class AppXExceptionHandler implements ExceptionHandler
|
||||
{
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.teamcenter.soa.client.ExceptionHandler#handleException(com.teamcenter.schemas.soa._2006_03.exceptions.InternalServerException)
|
||||
*/
|
||||
public void handleException(InternalServerException ise)
|
||||
{
|
||||
System.out.println("");
|
||||
System.out.println("*****");
|
||||
System.out
|
||||
.println("Exception caught in com.teamcenter.clientx.AppXExceptionHandler.handleException(InternalServerException).");
|
||||
|
||||
LineNumberReader reader = new LineNumberReader(new InputStreamReader(System.in));
|
||||
|
||||
if (ise instanceof ConnectionException)
|
||||
{
|
||||
// ConnectionException are typically due to a network error (server
|
||||
// down .etc) and can be recovered from (the last request can be sent again,
|
||||
// after the problem is corrected).
|
||||
System.out.print("\nThe server returned an connection error.\n" + ise.getMessage()
|
||||
+ "\nDo you wish to retry the last service request?[y/n]");
|
||||
}
|
||||
else
|
||||
if (ise instanceof ProtocolException)
|
||||
{
|
||||
// ProtocolException are typically due to programming errors
|
||||
// (content of HTTP
|
||||
// request is incorrect). These are generally can not be
|
||||
// recovered from.
|
||||
System.out.print("\nThe server returned an protocol error.\n" + ise.getMessage()
|
||||
+ "\nThis is most likely the result of a programming error."
|
||||
+ "\nDo you wish to retry the last service request?[y/n]");
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("\nThe server returned an internal server error.\n"
|
||||
+ ise.getMessage()
|
||||
+ "\nThis is most likely the result of a programming error."
|
||||
+ "\nA RuntimeException will be thrown.");
|
||||
throw new RuntimeException(ise.getMessage());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
String retry = reader.readLine();
|
||||
// If yes, return to the calling SOA client framework, where the
|
||||
// last service request will be resent.
|
||||
if (retry.equalsIgnoreCase("y") || retry.equalsIgnoreCase("yes")) return;
|
||||
|
||||
throw new RuntimeException("The user has opted not to retry the last request");
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
System.err.println("Failed to read user response.\nA RuntimeException will be thrown.");
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.teamcenter.soa.client.ExceptionHandler#handleException(com.teamcenter.soa.exceptions.CanceledOperationException)
|
||||
*/
|
||||
public void handleException(CanceledOperationException coe)
|
||||
{
|
||||
System.out.println("");
|
||||
System.out.println("*****");
|
||||
System.out.println("Exception caught in com.teamcenter.clientx.AppXExceptionHandler.handleException(CanceledOperationException).");
|
||||
|
||||
// Expecting this from the login tests with bad credentials, and the
|
||||
// AnyUserCredentials class not
|
||||
// prompting for different credentials
|
||||
throw new RuntimeException(coe);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
//==================================================
|
||||
//
|
||||
// Copyright 2010 Siemens Product Lifecycle Management Software Inc. All Rights Reserved.
|
||||
//
|
||||
//==================================================
|
||||
|
||||
|
||||
package com.zf;
|
||||
|
||||
import com.teamcenter.soa.client.model.ErrorStack;
|
||||
import com.teamcenter.soa.client.model.ErrorValue;
|
||||
import com.teamcenter.soa.client.model.PartialErrorListener;
|
||||
|
||||
/**
|
||||
* Implementation of the PartialErrorListener. Print out any partial errors
|
||||
* returned.
|
||||
*
|
||||
*/
|
||||
public class AppXPartialErrorListener implements PartialErrorListener
|
||||
{
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.teamcenter.soa.client.model.PartialErrorListener#handlePartialError(com.teamcenter.soa.client.model.ErrorStack[])
|
||||
*/
|
||||
public void handlePartialError(ErrorStack[] stacks)
|
||||
{
|
||||
if (stacks.length == 0) return;
|
||||
|
||||
System.out.println("");
|
||||
System.out.println("*****");
|
||||
System.out.println("Partial Errors caught in com.teamcenter.clientx.AppXPartialErrorListener.");
|
||||
|
||||
|
||||
for (int i = 0; i < stacks.length; i++)
|
||||
{
|
||||
ErrorValue[] errors = stacks[i].getErrorValues();
|
||||
System.out.print("Partial Error for ");
|
||||
|
||||
// The different service implementation may optionally associate
|
||||
// an ModelObject, client ID, or nothing, with each partial error
|
||||
if (stacks[i].hasAssociatedObject())
|
||||
{
|
||||
System.out.println( "object " + stacks[i].getAssociatedObject().getUid() );
|
||||
}
|
||||
else if (stacks[i].hasClientId())
|
||||
{
|
||||
System.out.println( "client id " + stacks[i].getClientId() );
|
||||
}
|
||||
else if (stacks[i].hasClientIndex())
|
||||
System.out.println( "client index " + stacks[i].getClientIndex() );
|
||||
|
||||
|
||||
// Each Partial Error will have one or more contributing error messages
|
||||
for (int j = 0; j < errors.length; j++)
|
||||
{
|
||||
System.out.println(" Code: " + errors[j].getCode() + "\tSeverity: "
|
||||
+ errors[j].getLevel() + "\t" + errors[j].getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package com.zf;
|
||||
import com.teamcenter.soa.client.RequestListener;
|
||||
|
||||
/**
|
||||
* This implemenation of the RequestListener, logs each service request
|
||||
* to the console.
|
||||
*
|
||||
*/
|
||||
public class AppXRequestListener implements RequestListener
|
||||
{
|
||||
|
||||
/**
|
||||
* Called before each request is sent to the server.
|
||||
*/
|
||||
public void serviceRequest ( final Info info )
|
||||
{
|
||||
// will log the service name when done
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after each response from the server.
|
||||
* Log the service operation to the console.
|
||||
*/
|
||||
public void serviceResponse( final Info info )
|
||||
{
|
||||
System.out.println( info.id +": "+info.service+"."+info.operation);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
//==================================================
|
||||
//
|
||||
// Copyright 2010 Siemens Product Lifecycle Management Software Inc. All Rights Reserved.
|
||||
//
|
||||
//==================================================
|
||||
|
||||
package com.zf;
|
||||
|
||||
import com.teamcenter.soa.client.model.ChangeListener;
|
||||
import com.teamcenter.soa.client.model.ModelObject;
|
||||
import com.teamcenter.soa.exceptions.NotLoadedException;
|
||||
|
||||
/**
|
||||
* Implementation of the ChangeListener. Print out all objects that have been updated.
|
||||
*
|
||||
*/
|
||||
public class AppXUpdateObjectListener implements ChangeListener
|
||||
{
|
||||
|
||||
public void modelObjectChange(ModelObject[] objects)
|
||||
{
|
||||
// if (objects.length == 0) return;
|
||||
// System.out.println("");
|
||||
// System.out.println("Modified Objects handled in com.teamcenter.clientx.AppXUpdateObjectListener.modelObjectChange");
|
||||
// System.out.println("The following objects have been updated in the client data model:");
|
||||
// for (int i = 0; i < objects.length; i++)
|
||||
// {
|
||||
// String uid = objects[i].getUid();
|
||||
// String type = objects[i].getType().getName();
|
||||
// String name = "";
|
||||
// if (objects[i].getType().isInstanceOf("WorkspaceObject"))
|
||||
// {
|
||||
// ModelObject wo = objects[i];
|
||||
// try
|
||||
// {
|
||||
// name = wo.getProperty("object_string").getStringValue();
|
||||
// }
|
||||
// catch (NotLoadedException e) {} // just ignore
|
||||
// }
|
||||
// System.out.println(" " + uid + " " + type + " " + name);
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue