|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
& i- A O# ^; d5 k! g, Q, u
Teamcenter SOA 开发基础代码解析
1 b: s' s9 g- Z4 s8 @* An instance of the Connection object is created with implementations of the9 q+ r+ [& r) L- V u( J, C: s1 j
* ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners$ s( W( A4 Z6 f' x4 W& k# O" ?
* intefaces. This client application performs the following functions:# A: i9 m$ t6 ~+ n
* 1. Establishes a session with the Teamcenter server
, O6 g3 w3 d* p; v: f9 D* 2. Display the contents of the Home Folder4 ]3 z+ Y6 e7 h9 T+ W1 R
* 3. Performs a simple query of the database `5 U _3 s. G$ P/ ^3 Q. B: Q
* 4. Create, revise, and delete an Item- Z5 ]0 W' [: {
. o' N% z: B) ^) d9 r' I& \+ h6 D% z2 @* [
public class Hello
) ]: y. w) W0 y9 D5 b4 E! b{
/ V, [4 C8 q, ^/**# ]( R% }; x- w& F4 _+ ]8 i7 u& }& {3 B
* @param args -help or -h will print out a Usage statement
* d5 @5 W5 o, j& M*/
' [2 H7 [* p+ b5 a1 X1 e( Y" {! Rpublic static void main(String[] args)
& _ s% x1 y1 ~3 i- \7 C{& R S7 E# j, S! X( t7 x
if (args.length > 0); b9 i6 u, @- d) }9 [4 d1 W
{
5 c3 k( c# \: _$ yif (args[0].equals("-help") || args[0].equals("-h"))1 i* _0 n: \2 T/ @. p6 K$ z# }* X1 I
{9 R# E! J- T0 D* d& V4 t5 ^
System.out.println("usage: java [-Dhost=http://server:port/TC] com.teamcenter.hello.Hello");4 H/ e9 `0 a/ G2 o( N
System.exit(0);
7 i' a) o* A @$ W T. t1 h}4 T" o) d! F) H4 A8 L
}
9 O& P3 _: B# ]2 L2 C0 x4 p// Get optional host information
/ S# l% @) ~: X1 MString serverHost = "http://localhost:7001/tc";
7 p0 L0 v2 `8 a% \- WString host = System.getProperty("host");
6 f; i& N, Y2 l# f! r, L. Mif (host != null && host.length() > 0)- K: z. ]- N- Y, }
{0 S, p" A+ v+ i: ]* S+ S
serverHost = host;) X! B' E3 y, u& C7 J0 ]1 g( L
} _" }8 H% ^0 K$ W$ Z/ ^! h8 w
Session session = new Session(serverHost);
9 I1 I, r7 L. ~. g- y0 K0 bHomeFolder home = new HomeFolder();. Q0 ^1 E |; M/ y
Query query = new Query();
5 v$ y8 B: G: v+ b, T8 [1 mDataManagement dm = new DataManagement();. ^. f& S1 I, c0 V2 B: q9 n
// Establish a session with the Teamcenter Server' m: u R) \: U
User user = session.login();
7 N2 u( ?: Y# x* m! U// Using the User object returned from the login service request' o. Z* _1 y: F3 n7 K' q( z( ^
// display the contents of the Home Folder
" f' g7 t3 S2 y1 `5 |" H) R1 hhome.listHomeFolder(user);
; Q" H) j0 H; _' _+ G% G6 g% F// Perform a simple query of the database; G, A' _% x% I
query.queryItems();; }6 S* U5 W: e# z3 h6 U
// Perform some basic data management functions3 I* s0 U# ?7 S. ~/ U' J9 z, ~ K
dm.createReviseAndDelete();
" j, s) x1 @: n' J8 P7 i// Terminate the session with the Teamcenter server
2 Y6 |1 `2 s/ x! X! y5 ~) f: R0 `3 osession.logout();7 P2 t8 W5 z; r0 |* C
}
4 O* ^8 u$ ]4 g& g}3 s' l2 e& l1 ]$ V
, r5 k6 \) u% e' ~& a |
|