|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
1 c- x. F! C+ t$ f6 E& zTeamcenter SOA 开发基础代码解析
8 M( l: `$ D. n+ m1 m* An instance of the Connection object is created with implementations of the
& W4 i2 a4 X# A, l! O* ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners
9 G. y: M& a" B5 Y8 g3 q6 w/ D5 _* intefaces. This client application performs the following functions:
- Y. e( A& s: t, d* 1. Establishes a session with the Teamcenter server- r" H, \$ W3 s" I9 r
* 2. Display the contents of the Home Folder1 k, V$ x. I/ [3 y2 F
* 3. Performs a simple query of the database
/ N$ _9 O" X Z7 i* 4. Create, revise, and delete an Item! w. D( c7 y: r3 E" _0 { p+ M
; ]- K8 q- O8 h1 ~$ c. C9 R9 d$ }1 p
0 L. ?5 D" _# }; l% k8 n) t; u# Vpublic class Hello9 `% i- p: n3 ]
{
3 p v2 x; Y% _, u- W/**
0 `( T7 x% g# q3 H) J( Q0 x* @param args -help or -h will print out a Usage statement
* L& u) e2 q9 b y7 ^*/
8 k, ?) _" p* C& Hpublic static void main(String[] args)* B$ x: N2 u- p
{
1 e! M" P( v4 y# xif (args.length > 0)
1 B+ O' {" X. c! H4 R{
" S, J- p: [; Gif (args[0].equals("-help") || args[0].equals("-h"))
7 T3 m. o. V- n1 A{
- h0 h. ?, d& DSystem.out.println("usage: java [-Dhost=http://server:port/TC] com.teamcenter.hello.Hello");5 [# J% d' }. [3 ]6 U
System.exit(0);
4 ]) L/ ~& L9 X}
5 ?& T) r$ x! z1 ]( R1 X: q}* p: E; H6 p; [
// Get optional host information. z# P) i8 N2 V6 |, U2 v9 c" W
String serverHost = "http://localhost:7001/tc";+ @. s x8 R8 B+ y3 V* {
String host = System.getProperty("host");
}3 u3 w, V8 ?6 Qif (host != null && host.length() > 0)4 G+ l/ ]; z1 H j. W/ j
{3 W' X5 M5 \& x9 a% }
serverHost = host;* }# f* ~ n% F9 t1 N4 `
}
- c. W7 e6 I$ B0 g2 S% PSession session = new Session(serverHost);! f$ {4 h7 o9 k6 v4 _; R0 h
HomeFolder home = new HomeFolder();4 [3 n1 v3 N. Y& j+ F
Query query = new Query();
' Z+ n( B' @4 w8 Y# hDataManagement dm = new DataManagement();
) K3 g. g5 u7 c1 }; N! Z. T// Establish a session with the Teamcenter Server
Q6 N9 S' P% b# K) T( F1 HUser user = session.login();
3 O* m0 T. [* \3 V% i// Using the User object returned from the login service request: w/ }) D* Z/ T6 o; G, i9 j4 ~9 b% i
// display the contents of the Home Folder' L& T$ F- f# W$ R% l: ~# M* w$ r# f0 }
home.listHomeFolder(user);
0 X L+ `- b" n( z6 p: }, l! Z8 O// Perform a simple query of the database
1 {( u3 v7 q# @) K: ?2 ^3 h7 fquery.queryItems();0 X7 w/ x' Y; p) ~) V" k; [
// Perform some basic data management functions& B1 X# R& l* w) C! T
dm.createReviseAndDelete();$ m' Y& ^5 c5 Y" P& h
// Terminate the session with the Teamcenter server9 @0 }) W" r: j- j% l& b4 o5 Y
session.logout();; z& P# w5 q# m! F' Z, t5 X- ~& Y
}
5 W- o" F' m- G* J1 F2 t3 m2 g}
3 p4 n2 n" u4 ^* y9 y O8 e; R4 [ ]* l9 F/ g7 g* [# p
|
|