|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
1 I3 b! ]& N* d+ K: m1 B STeamcenter SOA 开发基础代码解析" r5 M' x( V. Z1 E, Q: i% s0 w$ S
* An instance of the Connection object is created with implementations of the
: C3 G, E0 B8 k& {, G* ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners- H/ D, S7 ^* p( d& o: `& c$ G9 ]
* intefaces. This client application performs the following functions:/ f% g; D7 C+ m' Y: t% G8 @+ Z: Y
* 1. Establishes a session with the Teamcenter server
, \/ B- e$ v, K; a* O5 C* 2. Display the contents of the Home Folder
7 a6 Q/ S$ c2 V; J, q+ q* 3. Performs a simple query of the database
) }9 `9 n7 d ]* 4. Create, revise, and delete an Item
1 h. f1 N+ C: M5 R" _
& X# p- q" x" K# ]9 G! H! W5 C* ?
9 j7 }3 M0 x9 i% U# a% e' opublic class Hello
; \; A. W( Q) \" q2 [+ o0 r5 b{2 f: c1 A+ P/ l- O6 f6 K& Z
/**6 i% U# U" v+ {; Q: D
* @param args -help or -h will print out a Usage statement& s( J- a7 `0 H$ N7 u) i
*/5 e3 G( m/ p' c% \! ^, B& _
public static void main(String[] args)' g3 r- C2 e: x8 u) I
{
3 J& ]1 z# x) _( M8 e) I9 G. Kif (args.length > 0)
( D1 }3 e6 h! C% g/ |+ L6 @, H6 o{; d4 M- g3 G5 E
if (args[0].equals("-help") || args[0].equals("-h"))# q4 W: E- R( o: D
{
4 e# Q+ U" y' ESystem.out.println("usage: java [-Dhost=http://server:port/TC] com.teamcenter.hello.Hello");' X+ N- s; i2 T5 u" k# L1 t$ T
System.exit(0); U5 _0 ]5 g( j2 c# d
}
! l6 k7 t5 m6 e, d2 H8 b2 i}
7 }4 A' R/ d. y# J% @" X4 o// Get optional host information
! N* g7 d9 ^' c, B( ^' m! q/ x. q" q' CString serverHost = "http://localhost:7001/tc";, d! C! S# K- c( g$ C
String host = System.getProperty("host");
3 ^+ `' F3 \- a5 {- O' Rif (host != null && host.length() > 0)# I! g$ h( a5 ~* L2 G1 d1 T
{
" b/ |4 A) P/ r0 G3 O% K, SserverHost = host;
, Q; y5 x7 M* n3 L3 N* Y}
0 P9 z) @% h! ?7 ~Session session = new Session(serverHost);! _& _4 {7 x/ t9 O8 _8 r8 w* O
HomeFolder home = new HomeFolder();! n' _6 Q& j9 c; ], ?
Query query = new Query();
+ }: X- y2 O3 n: B* V: ~( {DataManagement dm = new DataManagement(); V9 o2 L- F% o, U
// Establish a session with the Teamcenter Server
6 T+ J+ F: x. _ hUser user = session.login();+ b" v! s6 b& ~4 q# L
// Using the User object returned from the login service request( o' J9 @9 D3 t. X# Y$ e! ~
// display the contents of the Home Folder
, H! o, s% Z+ L; j; k9 V% f* mhome.listHomeFolder(user);
4 |/ {5 ?0 ^6 R// Perform a simple query of the database
$ b9 } l3 Y' x( {4 j/ N$ f0 Z3 \query.queryItems();( x+ [4 s7 n/ ?. G; k1 l
// Perform some basic data management functions
- r9 F, O# b: G0 udm.createReviseAndDelete();5 [* T4 m- d, ^3 J/ [5 q- y
// Terminate the session with the Teamcenter server
" o5 v2 ?% T( `- P: K6 G: hsession.logout();
5 t% y a Q3 F}, m' X4 C% v' a& |3 v( M
}* ?4 e/ F2 L$ U% E: x/ F
: S+ h( {) C9 w
|
|