|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
% Q6 G z# P0 U: A* D5 wTeamcenter SOA 开发基础代码解析 t4 l! @) ] ~; E! ?1 u
* An instance of the Connection object is created with implementations of the! P( _1 |. Q; x$ n
* ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners
, \# b9 G+ M, o+ K, `- }# A* intefaces. This client application performs the following functions:
X- V% Y+ M! T% G* 1. Establishes a session with the Teamcenter server
9 c1 w* j1 J" Q) g, V* 2. Display the contents of the Home Folder7 p5 X1 }/ U' l; G) r
* 3. Performs a simple query of the database* `% {. b5 R* d
* 4. Create, revise, and delete an Item
7 L" u% }" k/ E1 Z( Q4 c) c- N/ s' {% N* T; ?- b
& k- K; N/ T9 n/ p7 qpublic class Hello
: m1 ?1 Z9 _$ c2 C: M{
7 P# x, E9 z' x3 V+ z5 V$ R! p/**: b5 X4 {6 m9 B5 q
* @param args -help or -h will print out a Usage statement
5 R% r \! t9 @' b2 G) a*/
, G4 w( h/ {( | R7 B& O% ]' Kpublic static void main(String[] args)* F5 r! B6 K7 _
{* o, h' e) k8 C- W; M5 A7 l
if (args.length > 0)
+ O. j/ q% l1 v6 r{+ P* y! j& }/ I* X ~
if (args[0].equals("-help") || args[0].equals("-h"))
+ U6 n( r) X! C7 i+ B8 J; s$ `{
1 W* `/ `7 D) E$ b5 ]8 I7 tSystem.out.println("usage: java [-Dhost=http://server:port/TC] com.teamcenter.hello.Hello");
& |2 a4 e0 G& {System.exit(0);
& F+ N$ U6 |2 A+ i5 k; l8 Y}% L" w+ V6 d. | B6 {4 c" }. n6 K
}
" R2 V! F g: a% K6 y4 B. \// Get optional host information% g* d& x: g# Q. ^+ E% L
String serverHost = "http://localhost:7001/tc";
9 i; O* `" o( ?3 p, [% A1 NString host = System.getProperty("host");
2 i; {% v* t1 T4 x( z* v" Iif (host != null && host.length() > 0)
6 p9 [- t X+ V% ^' A, X: v{
7 }* ^8 H3 O4 r$ hserverHost = host;% ^4 W* g$ r# c4 B8 f9 q
} U9 |8 y% v, x+ R% @. \
Session session = new Session(serverHost);
! S* j( K+ v( S* G) \- |# e5 sHomeFolder home = new HomeFolder();" r8 @; [ s, j0 [% r0 Q8 ~
Query query = new Query();; v% b: J% j5 J$ F/ L s
DataManagement dm = new DataManagement();
. X8 d4 B' J5 q* V* ?$ z; \// Establish a session with the Teamcenter Server
! ~1 y) e- t0 V) m. _1 LUser user = session.login();) r/ s: z2 {+ h) G+ X- ^# n
// Using the User object returned from the login service request
. m3 d) ?% t! _// display the contents of the Home Folder g0 b) H% Q0 `
home.listHomeFolder(user);
9 J& i4 k, c& _: S9 Z& A3 w$ H// Perform a simple query of the database
4 Z, r+ s/ G( }! [6 aquery.queryItems();
. m' x0 q) f- u* _: b& J// Perform some basic data management functions
9 h) G$ D, @) g/ Ndm.createReviseAndDelete();
7 V) Y. W7 v( E/ [9 S1 G1 I// Terminate the session with the Teamcenter server
3 v7 @9 ~/ H& k! r; I: ssession.logout();+ p* N+ q6 V4 S0 Q1 L
}1 L9 d! C! X" i' o ?" e" @
}
! g$ {1 I. H' T! O
- ?, P$ Z7 i4 U9 T' |# r |
|