|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
. Z9 k6 d# S1 U6 u' H
Teamcenter SOA 开发基础代码解析
2 S/ c- V$ m* P# K- y$ x5 l; B2 ~$ l* An instance of the Connection object is created with implementations of the
) Z! R% J1 ], s" D$ W* ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners
& Z2 r, t/ r, v2 {" K* intefaces. This client application performs the following functions:
* }! l! G' X& E# C4 m* 1. Establishes a session with the Teamcenter server9 L. Q+ Y& `6 ^ t( m
* 2. Display the contents of the Home Folder
8 n4 Y! S: Q7 n$ A) E* 3. Performs a simple query of the database5 G3 y( K4 D: H1 P* E: f
* 4. Create, revise, and delete an Item
1 v: B. y0 z- \. I9 i* N9 V7 V9 N9 a0 U: @$ W
! l3 ?9 U# G) A; Y$ upublic class Hello' M) S/ f) Q' r
{) a2 M1 L3 S1 V# B9 R' d+ O
/**' z( R- d/ Z3 Z- ^: w& z/ V
* @param args -help or -h will print out a Usage statement
: H6 Y5 m# S E; T" h*/+ t6 L3 ^9 A; F( f; M
public static void main(String[] args). r* m% B3 _4 H) t1 ~
{
6 ?6 @9 k1 T. O5 k$ e0 V+ ~" q) J/ q5 Zif (args.length > 0)/ F* b% y Q, w: E0 B% C( j( m; T
{
`$ N, c" d7 O( N7 B1 Hif (args[0].equals("-help") || args[0].equals("-h"))
; c" I2 D% q) ]{
0 I4 V b" ~# S7 USystem.out.println("usage: java [-Dhost=http://server:port/TC] com.teamcenter.hello.Hello");
. P0 m/ ^8 Y' L1 ^# h/ Q8 sSystem.exit(0);
% G& U9 r. W' R6 n}
" ?( ~) [7 W7 Z} L6 f. q; U# e' s; k' Q, h
// Get optional host information
5 R0 r2 `! Y- K+ gString serverHost = "http://localhost:7001/tc";; g$ d# A/ n5 J! e
String host = System.getProperty("host");
) S; O9 `- h( n, C, Y, Aif (host != null && host.length() > 0)
4 B- T, ?1 ]: ^! Q1 d- s9 v{
, c8 [& c6 {+ ~, g% A; FserverHost = host;
# _# Q( h( d, f& S3 p' _* S) H}
/ d$ {. }0 X3 m8 h& O/ OSession session = new Session(serverHost);# `5 Q5 H% w0 P6 L
HomeFolder home = new HomeFolder();: t$ R7 U5 g- l' D
Query query = new Query();
; Q3 C9 H" E2 F) S/ e* y) ADataManagement dm = new DataManagement();0 U+ D9 y6 l2 A; }( ]3 M& U2 R
// Establish a session with the Teamcenter Server. a# l7 p6 _4 M# Y- m
User user = session.login();
" m& N# M+ c) q% L' F// Using the User object returned from the login service request
: {- W$ t+ I$ Q- j6 Y// display the contents of the Home Folder' N# d$ s9 m! D4 R( R' f3 S) V2 e
home.listHomeFolder(user);
* s+ q0 r( c) k/ }// Perform a simple query of the database
/ l; O+ k2 L2 B2 yquery.queryItems();
1 ?) S! G4 K( v" ]// Perform some basic data management functions) { r9 I1 H0 C5 ~5 ~
dm.createReviseAndDelete();2 \* q; F3 y' n; }- _: d* {
// Terminate the session with the Teamcenter server
# R+ |, b* i+ m. B8 j" Ysession.logout();
# f- x1 h- L; _: L}
/ h9 P6 H7 n' p5 X3 A H9 V3 A}+ B& y+ Z! s) Y1 f% g
) F" x1 d7 e; N0 r
|
|