|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
& _+ e' ^" [/ @# p- [# G7 I( T* z* m
Teamcenter SOA 开发基础代码解析1 b' k, j3 C0 I
* An instance of the Connection object is created with implementations of the6 C$ C% S3 `) [+ I' G
* ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners
* C' c& n% v* p+ K* N* intefaces. This client application performs the following functions:
! p) a) e# i" h) c1 \, J1 k! r1 e* 1. Establishes a session with the Teamcenter server
, F# N4 W3 \0 G% C) E3 x! j* 2. Display the contents of the Home Folder$ w1 P# ] ]4 Y, m" O
* 3. Performs a simple query of the database
& v$ A9 f- ?4 T2 j) i$ b& a" d* 4. Create, revise, and delete an Item ?; u0 r! n. I6 L( p* k
3 N C( y7 u7 m1 [
) A! { l I+ }9 x+ t7 j; ?public class Hello
* }. r3 F8 ]- }5 _2 u/ h{
2 ]9 V9 r- s' R3 S6 c/**' [. g9 y/ Z; f! [
* @param args -help or -h will print out a Usage statement2 }. H/ c" }- j9 B& T+ i
*/
! g1 U: |4 h; @8 s# S0 D! F5 {public static void main(String[] args): N, k: z1 v0 H; \) M
{# b1 o, q8 x2 A. p
if (args.length > 0)
. O- T9 r) K0 d4 i# w{% B' \# b; S% D! \ a
if (args[0].equals("-help") || args[0].equals("-h"))
) v: f* V) H6 z) R D; K, I) i{0 v) ` j% x1 Z8 v
System.out.println("usage: java [-Dhost=http://server:port/TC] com.teamcenter.hello.Hello");1 Y5 N( J' s" k* o" K8 P
System.exit(0);$ h- Q7 N/ o/ e3 @1 S: ?
}! O* Y8 E% Y* [/ P x) A4 I
}4 U2 Q8 S2 G. y! E: L5 x! @8 I
// Get optional host information
! U2 c8 [. y }( v3 NString serverHost = "http://localhost:7001/tc";. }' k+ X& b- `0 z6 J! Z
String host = System.getProperty("host");
- F9 @$ c" T3 M, Q$ ^' Jif (host != null && host.length() > 0)( v% j% L# G( i: |' f
{) I! {* D4 N* L- M5 [# P
serverHost = host;
2 U" W* `( x. a5 h8 b/ i& M# L2 g}3 ]" r. G0 U" ~$ q$ F# }7 G# N
Session session = new Session(serverHost);
5 i# O4 P" ~, e0 a8 |% RHomeFolder home = new HomeFolder();
' V, ]8 N! @7 lQuery query = new Query();2 I/ y7 x7 Y1 c8 Z! R) D/ o, @- r
DataManagement dm = new DataManagement();
# z3 G0 H$ p7 H' i// Establish a session with the Teamcenter Server: n5 R V+ T/ G* M
User user = session.login();
2 U9 s: m7 B4 L0 {8 C// Using the User object returned from the login service request
+ H6 F. i3 K) n) M* j// display the contents of the Home Folder
) I0 Q& z1 [( i+ jhome.listHomeFolder(user);
0 W e- Y4 Y4 [// Perform a simple query of the database
8 N. V3 |- \+ x) E4 oquery.queryItems();
0 c2 }$ u& m, ~8 f// Perform some basic data management functions; w% M0 |7 o8 X. q# S4 y, F) E( E
dm.createReviseAndDelete();
9 L. _; J, T* R2 ^: b4 W- \+ Q// Terminate the session with the Teamcenter server
4 J4 ]/ {3 z. Y, ~session.logout();( V" ~) T8 b/ b5 n: S0 X7 E
}
, Q4 f1 a0 M6 V& h, z}
9 k, x/ h, a! i- E& y ~- y! R n/ ^9 I! k' Q% q$ ?, Z
|
|