|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
* l* E4 A! Y5 b+ {! WTeamcenter SOA 开发基础代码解析
4 k4 ^2 B6 ~: P$ m% F" ~* An instance of the Connection object is created with implementations of the: p# Z b2 a& V5 P9 q$ E( z
* ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners
S3 i) Z+ o# h8 A* intefaces. This client application performs the following functions:
5 e+ P$ \4 U! z4 j- \& k" t* 1. Establishes a session with the Teamcenter server
! m- r0 X; _9 |$ w |6 U) E* 2. Display the contents of the Home Folder) ~# e$ B7 ?: [6 ]! j% J2 e
* 3. Performs a simple query of the database( j! k% Q/ K. i" _+ d& @1 {# `* u
* 4. Create, revise, and delete an Item7 f0 V( t+ ^ l* s/ @! y
: J' O2 ?, W( N) Q/ `( _" g
d! ?/ w$ V6 ?# {5 Bpublic class Hello. s' k. }1 D# m6 \$ G
{* O3 z# a% K6 T }, r4 i, a
/**" l% z1 j% ]; I+ G
* @param args -help or -h will print out a Usage statement
, ]0 s: a$ H( a/ G( |*/! ?* B" f7 L" @" |* a, Y7 B0 r8 ^
public static void main(String[] args), n, N, d& @6 p" F. X$ G
{
- M6 Y9 ?1 L( A# I$ D/ `9 h) cif (args.length > 0) y3 z# x4 `: K$ A
{3 u& N0 p: C; {: G9 B
if (args[0].equals("-help") || args[0].equals("-h"))
1 H) I+ ~7 s" a{
' U! C; p# u& |' a' Y2 T8 KSystem.out.println("usage: java [-Dhost=http://server:port/TC] com.teamcenter.hello.Hello");
! @1 H/ c; U$ i' t. b* q( o) {System.exit(0);/ X S. t6 m R. @! G8 |( W1 L
}" S6 n1 N) ]8 g9 U$ N5 S% }
}" k" W3 h) f; A; B8 b& \
// Get optional host information/ G% ]4 i3 w) s: b1 ?7 R
String serverHost = "http://localhost:7001/tc";: _# G. d! z2 E. z% c n
String host = System.getProperty("host");+ i. T2 k7 T' h- M; v/ D- @' @ H2 }- f
if (host != null && host.length() > 0)- {4 I( \9 `# @+ R3 P+ v
{, ]$ L3 W) V1 t
serverHost = host;0 }) m2 X8 }9 ]
}) ]* Y1 B4 I4 b+ f" Q& J
Session session = new Session(serverHost);
$ i$ p9 z( l9 H7 }! z# L' uHomeFolder home = new HomeFolder();
2 E/ O/ E% _. {- LQuery query = new Query();
E. T% S3 p9 @. ]& k1 B3 F, k) t1 nDataManagement dm = new DataManagement();
8 ^) Q/ j5 Q" z. b+ s( d( k) g' I# D9 a# |, W// Establish a session with the Teamcenter Server
( z) b! A4 k, I0 E' y% B6 RUser user = session.login();
2 X2 o) p& I1 V" v% Z// Using the User object returned from the login service request
2 c8 A+ m: C' ]7 c+ l// display the contents of the Home Folder
1 v2 {4 W- ]$ Bhome.listHomeFolder(user);
\4 p2 Y( C Z! ~" e; ?// Perform a simple query of the database4 u: r$ V0 v2 P* y* [
query.queryItems();
6 `0 A+ r( u. i6 {( Z: q// Perform some basic data management functions) ^% k2 f* E3 I9 r" k
dm.createReviseAndDelete();; P% _- R: z4 \; z
// Terminate the session with the Teamcenter server' \1 l/ r/ q! a8 ?( K
session.logout();
( I' J% R: d. R2 n}
" ]( `" S; \' w+ |; Q' J}* g# m. K0 O: f9 ]9 G
- ?% O3 s1 ?( M2 u6 W2 }
|
|