|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
8 O- d4 n/ Q( S; V
Teamcenter SOA 开发基础代码解析
0 ]& B% J% l- L% u H/ y* An instance of the Connection object is created with implementations of the
8 n8 M, \- N+ |6 q f* ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners0 @8 P9 U0 j0 n+ X
* intefaces. This client application performs the following functions:% A, O( }9 a$ H
* 1. Establishes a session with the Teamcenter server0 m4 ^' r% _' b3 G& H
* 2. Display the contents of the Home Folder
* T; E+ e g" `* 3. Performs a simple query of the database
8 h e/ B2 B1 l8 `1 C2 r4 U, K! k* 4. Create, revise, and delete an Item7 j- I" Y! K7 _7 ?8 C
! a/ ^" E7 i/ K* I1 j" n# o& V6 a; }
: {2 r3 V1 z4 @4 lpublic class Hello, r% d# L; k5 p
{6 k0 j1 b: k8 z* |4 [2 O- ]+ D
/**, v0 X$ ^, Y, j2 B# p
* @param args -help or -h will print out a Usage statement
% K L& Z! I& y*/
3 L* Y B( s w0 s: Epublic static void main(String[] args)( L; c: o) h7 a2 Y
{0 `/ L q* X0 y
if (args.length > 0)
9 x+ K7 X; k4 g6 E{# w9 G( _1 F# E" R, `0 d
if (args[0].equals("-help") || args[0].equals("-h")): ]& V8 |+ @8 g. r; }6 p4 G; O
{4 \: @& c3 ^" o
System.out.println("usage: java [-Dhost=http://server:port/TC] com.teamcenter.hello.Hello");
O' I1 N- {( I; \( n+ @System.exit(0);! {5 S2 S+ E/ N- o3 O; r: V
}) U9 Y0 w, I. F# ]* D, m0 P
}# E( Y8 b0 N+ U: I U0 S: W! C3 O* f
// Get optional host information R5 L; w+ k' ]6 ^5 w
String serverHost = "http://localhost:7001/tc";
3 k$ y* ]# L6 K- o) u8 AString host = System.getProperty("host");
6 }4 N7 C0 G' d Iif (host != null && host.length() > 0) w$ h* |8 P- i* `
{
1 V5 W" F- P3 eserverHost = host;6 B* ]+ w4 s# F# b, T9 L" b
}
; E! {5 z! J5 l. W& C `Session session = new Session(serverHost);7 C% a W2 g) h: o' b
HomeFolder home = new HomeFolder();% n' i( L @1 u0 r$ ^! d* u
Query query = new Query();
6 g' d/ c: d# S0 _5 U4 PDataManagement dm = new DataManagement();
- q E' d4 W0 O4 V+ ~) S// Establish a session with the Teamcenter Server
7 }- l) F: y" p3 }. z, j' X( tUser user = session.login();
, v( D2 N W+ K, j% I// Using the User object returned from the login service request7 u9 A6 J/ M5 }% h6 n9 N
// display the contents of the Home Folder
4 j" x* o! f- S7 F1 t. c& P5 E/ \home.listHomeFolder(user);
1 h& Y; ?' S3 O2 G// Perform a simple query of the database
! F v$ ?2 F& G* J' e$ gquery.queryItems();
" y$ y5 L; S! c {// Perform some basic data management functions5 w" i& C" c1 o+ |. A" }2 R
dm.createReviseAndDelete();" O- ~1 b/ I4 N
// Terminate the session with the Teamcenter server* K, l7 T [7 E; h
session.logout();
}5 q" A( ` Z}
" x& y" K- h) Y0 }}4 {, Y+ q/ k K6 `/ u/ c
9 m$ g+ q; T3 a% Y1 ? |
|