|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- t q" i6 T2 ?: {. g1 ` LTeamcenter SOA 开发基础代码解析( E5 V2 o* J; m* D+ m. c
* An instance of the Connection object is created with implementations of the
1 d0 z5 @$ X/ G' O" q }* ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners
7 D# B5 A* Z1 R( V0 e* intefaces. This client application performs the following functions:
7 i- D; Z' t/ [( g9 d! V3 i l* 1. Establishes a session with the Teamcenter server0 X1 L8 k1 F& s9 Y; u# z" l
* 2. Display the contents of the Home Folder
2 f D" w! z9 \* p' D* 3. Performs a simple query of the database
( x& e. y/ C( ]- g% t* 4. Create, revise, and delete an Item
! L2 p# J7 R' J8 F! g; L; p$ m# m: l1 m7 D
: i: U) B: O8 P8 e; n' o
public class Hello
0 J( ~& c. X7 U1 }1 P{
! t2 M' i! k' Y6 r! H/**7 E; ~0 `$ c$ s. A9 d8 G
* @param args -help or -h will print out a Usage statement
7 }! `/ e7 k$ a U* A' K*/& }& g) c r6 p9 s3 s. o
public static void main(String[] args) d+ Z- h/ _ ^+ t* o- x
{( Z. _9 ^- N8 W7 s" @7 \
if (args.length > 0)( w4 r# E5 N+ a( R1 W# i8 j! |
{ ]% {' y/ r% `: k) _4 k) |
if (args[0].equals("-help") || args[0].equals("-h")) S% Q3 K- H8 Q+ P! n J% L
{
. ^2 D# O9 i% [9 O) DSystem.out.println("usage: java [-Dhost=http://server:port/TC] com.teamcenter.hello.Hello");' ^6 t7 `$ E' S; G
System.exit(0);
( r6 h) X0 ^; X. c* J/ r9 i}7 k" r# ~% B o* U X
}
9 W0 T. H* K/ B// Get optional host information* @: k8 M" {/ i; q4 Z$ `5 {
String serverHost = "http://localhost:7001/tc";
& ]" p) y( b8 W* iString host = System.getProperty("host");
5 Q, _/ S3 a1 o% Cif (host != null && host.length() > 0)
; }! y. Z) n7 M9 j7 W7 m$ @/ ?{' {; U& d) ?0 A* L, K
serverHost = host;
5 i/ S3 V3 y7 H}/ {# R8 r) G6 ^
Session session = new Session(serverHost);/ p3 C# F5 {: K# _
HomeFolder home = new HomeFolder();4 L8 A, a' S. }8 W
Query query = new Query(); E( ]4 M: k/ `9 v- k ^
DataManagement dm = new DataManagement();
4 D/ \0 |: N$ B) j$ d2 m// Establish a session with the Teamcenter Server# q% h. y4 |% ^. `9 c
User user = session.login();
+ j8 ]5 [2 h. t& J3 X// Using the User object returned from the login service request5 O7 J, q6 f$ ]( E9 }% ? m! ]
// display the contents of the Home Folder3 ^+ f! {8 a8 \
home.listHomeFolder(user);
8 K5 H n! a4 h! f. J* A f% N/ }/ {// Perform a simple query of the database
" r" P1 f, D8 \$ P4 _2 n# {! a* u" |: `query.queryItems();
9 u; P3 M, s( ~1 Y O// Perform some basic data management functions w5 ~/ o+ Y- w+ b U# R1 u# S- ^
dm.createReviseAndDelete();7 a7 m9 m7 `$ `- ~& {9 T8 z
// Terminate the session with the Teamcenter server+ T! x. C* ]' I% w) t4 j
session.logout();/ v* R! _ }8 C2 R% B$ C. l1 a
}
0 z+ W# n% e, J8 }& C# s}* t- \! }3 K) {, @+ c) U
- J3 F) y8 |# }, w
|
|