|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
. f% m$ R/ b! p* I7 k) Q( A* _
Teamcenter SOA 开发基础代码解析, R3 J8 t# F' w$ o [
* An instance of the Connection object is created with implementations of the1 _1 j% e5 W1 B4 H6 e: R
* ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners
% q: f: g; D( A6 n' g' t6 {* intefaces. This client application performs the following functions:
' q- V; z/ E0 V/ z$ D* 1. Establishes a session with the Teamcenter server
* a4 M4 ?" y, l2 S* 2. Display the contents of the Home Folder
) ^" E8 o' y+ d- I, ^* 3. Performs a simple query of the database) k, i \9 |% p- v
* 4. Create, revise, and delete an Item
8 C6 \+ |$ p: l) V' K
% ?. F% }. y5 s& a9 }
; [9 M4 ^8 U( {1 ?8 ]: ~! fpublic class Hello" w, e. R. R; g% a1 k
{
, @7 u" H% S4 I8 t$ ]* h; Y/**: c8 s' A7 ?3 F6 D
* @param args -help or -h will print out a Usage statement, N$ r3 c0 G5 E1 R! }: ~, X
*/
- O+ ]) E) Z6 i Z4 g/ v$ o& u, }& Ypublic static void main(String[] args)
) a; u H ?3 n2 N. X* v{
0 R0 {% k8 y7 ~" K4 Eif (args.length > 0)+ q7 [9 [+ u7 f. R# G( p
{' r- a2 U: R" L3 u4 R+ i' M) l
if (args[0].equals("-help") || args[0].equals("-h"))) l' d* M n, \7 D
{# T) ~- c8 R& a0 p& V0 V4 z, o
System.out.println("usage: java [-Dhost=http://server:port/TC] com.teamcenter.hello.Hello");. ]& o# Q: L% ^ Y
System.exit(0);
0 H( {& Y# i/ z/ b" v( p0 R}
' d0 s9 N8 ~& T( ]}
& s* o4 @7 {7 O# _, y! u) {// Get optional host information( O+ k; X9 R: ^! D; }/ S/ p* u* L" t' `
String serverHost = "http://localhost:7001/tc";$ ~0 B0 `4 f. U% D% t7 X% j
String host = System.getProperty("host");9 o7 F$ v q5 J
if (host != null && host.length() > 0)
: q) o5 f3 y; h5 W! U{
1 S L+ u- D4 w$ g- \( HserverHost = host; b$ B- x j- S# w+ J- O
}# y' f# h2 N# ^
Session session = new Session(serverHost);0 n; P% Q5 y( L
HomeFolder home = new HomeFolder();
( ^* l' t7 a8 a4 h& e# m' ZQuery query = new Query();
1 O5 M9 ~+ ]- U# bDataManagement dm = new DataManagement();
. N# \4 X6 f. i3 y& |// Establish a session with the Teamcenter Server
]* N' H# J5 W' t( R1 {User user = session.login();
, a- A1 O# P4 j2 q// Using the User object returned from the login service request
1 ^( k0 w7 k+ L. Z// display the contents of the Home Folder8 a+ q* O, p N
home.listHomeFolder(user);
# a: L! E$ _5 z9 }' e; A1 E, k* {// Perform a simple query of the database
8 u0 V: c* D- J; Zquery.queryItems();6 G5 l( @, V7 p& {) Z3 y( r- h
// Perform some basic data management functions
$ \3 G" H! @% Vdm.createReviseAndDelete();
- r% ~6 ?4 K. C5 }; I// Terminate the session with the Teamcenter server5 v# y4 t! A: T/ P; l) e5 C
session.logout();% p5 G. Q8 H$ W/ Q3 i
}
: O% m" P- _0 D}5 n. l% E9 d+ }: x3 g* k1 f
' b7 N7 J( A' F4 t, z, t |
|