锘??xml version="1.0" encoding="utf-8" standalone="yes"?> public interface HelloRemote extends Serializable { public String getString(int i); @Stateless public String getString(int i) { } public class Test {package com.juxiang.pojo;
import java.io.*;
public class MyEclipseGen {
private static final String LL = "Decompiling this copyrighted software is a violation of both your license agreement and the Digital Millenium Copyright Act of 1998 (http://www.loc.gov/copyright/legislation/dmca.pdf). Under section 1204 of the DMCA, penalties range up to a $500,000 fine or up to five years imprisonment for a first offense. Think about it; pay for a license, avoid prosecution, and feel better about yourself.";
public String getSerial(String userId, String licenseNum) {
java.util.Calendar cal = java.util.Calendar.getInstance();
cal.add(1, 3);
cal.add(6, -1);
java.text.NumberFormat nf = new java.text.DecimalFormat("000");
licenseNum = nf.format(Integer.valueOf(licenseNum));
String verTime = new StringBuilder("-").append(new java.text.
SimpleDateFormat("yyMMdd").format(cal.getTime())).append("0").
toString();
String type = "YE3MP-";
String need = new StringBuilder(userId.substring(0, 1)).append(type).
append("300").append(licenseNum).append(verTime).toString();
String dx = new StringBuilder(need).append(LL).append(userId).toString();
int suf = this.decode(dx);
String code = new StringBuilder(need).append(String.valueOf(suf)).
toString();
return this.change(code);
}
private int decode(String s) {
int i;
char[] ac;
int j;
int k;
i = 0;
ac = s.toCharArray();
j = 0;
k = ac.length;
while (j < k) {
i = (31 * i) + ac[j];
j++;
}
return Math.abs(i);
}
private String change(String s) {
byte[] abyte0;
char[] ac;
int i;
int k;
int j;
abyte0 = s.getBytes();
ac = new char[s.length()];
i = 0;
k = abyte0.length;
while (i < k) {
j = abyte0[i];
if ((j >= 48) && (j <= 57)) {
j = (((j - 48) + 5) % 10) + 48;
} else if ((j >= 65) && (j <= 90)) {
j = (((j - 65) + 13) % 26) + 65;
} else if ((j >= 97) && (j <= 122)) {
j = (((j - 97) + 13) % 26) + 97;
}
ac[i] = (char) j;
i++;
}
return String.valueOf(ac);
}
public MyEclipseGen() {
super();
}
public static void main(String[] args) {
try {
System.out.println("please input register name:");
BufferedReader reader = new BufferedReader(new InputStreamReader(
System.in));
String userId = null;
userId = reader.readLine();
MyEclipseGen myeclipsegen = new MyEclipseGen();
String res = myeclipsegen.getSerial(userId, "20");
System.out.println("Serial:" + res);
reader.readLine();
} catch (IOException ex) {
}
}
}
]]>
]]>
鐜
MyEclipse5.5
JBoss4.2.0
嫻嬭瘯鐩殑:緹ら泦EJB3
棣栧厛鎴戦棬鍏堝惎鍔↗BOSS.涓嬮潰鎴戠敤%JBOSS%鏉ヤ唬鏇縅BOSS鐨勮窡鐩綍
鍦?JBOSS%\bin鐩綍涓嬪厛鍒涘緩涓涓猂UN.BAT鐨勫揩鎹鋒柟寮忕劧鍚?榧犳爣鍙沖嚮灞炴х粰鏂板仛鐨勫揩鎹鋒柟寮忓姞2涓弬鏁扮1涓弬鏁版槸-C ALL 鐩殑鏄浠栧惎鍔ˋLL鏈嶅姟,絎?涓弬鏁版槸-B 192.168.0.60閮藉紑鍑烘潵浜嗘妸鏄湰鏈篒P鍙湁鍔犱簡IP鍦ㄥ彲浠ヨ浠栬鍦ㄥ眬鍩熷唴閮ㄨ璁塊棶鍒?鎴戝仛鐨勬槸3鍙拌綆楁満鐨勭兢闆?鎵浠?澶満瀛愪笂鐨凧BOSS閮界殑榪欎箞鍐欐敞鎰忓啓瀵笽P.鐒跺悗鍚姩JBOSS OK鐜灝辯畻OK浜嗙劧鍚庡紑濮嬪啓EJB3
鍐欒繙紼嬫帴鍙?br />
鐒跺悗鍐欐湰鍦版帴鍙?br />
@Clustered //EJB3緹ら泦鐨勬爣絳?br />
@Remote(HelloRemote.class)
public class HelloRemoteService implements HelloRemote {
System.out.println("鎴戣鎵ц浜嗙"+i+"嬈?);
return null;
}
%JBOSS%\server\all\farm鐩綍涓?娉ㄦ剰鍦ㄨ繖涓洰褰曞彂甯冨畬鍚?鍏朵粬鏈哄瓙涓婂悓鏃朵細鍝嶅簲鍙婂叾浠栨満瀛愪笂涔熶細鍙戝竷瀹屾垚榪欎釜JAR鍖?涓嬮潰寮濮嬭繍琛岃繖涓狤JB,褰撶劧瑕侀噸鏂板湪灞鍩熺綉鍐呮壘涓鍙版満瀛愬仛瀹㈡埛绔皟鐢?
棣栧厛鍦ㄩ偅鍙版満瀛愪笂灝嗗垰鎵嶇殑JAR鍖呭鍏ラ」鐩腑瀹屼簡鍐欐祴璇曚唬鐮?br />
Public class EJBFactory {
public static Object getEJB(String jndipath) {
try {
Properties props = new Properties();
props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
props.setProperty("java.naming.provider.url", "192.168.0.149:1099,192.168.0.60,192.168.0.51:1099");
props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
props.setProperty("jnp.disableDiscovery", "true");
//
// props.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
// props.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
// props.setProperty("java.naming.provider.url", "192.168.0.251:3700");
// props.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
//
InitialContext ctx = new InitialContext(props);
return ctx.lookup(jndipath);
} catch (NamingException e) {
e.printStackTrace();
}
return null;
}
}
鐪嬫竻妤氭垜鍐欎簡3涓狪P鍦板潃,榪欐牱鍋氱殑濂藉鏄殢渚塊偅涓満瀛愭寕鎺夊叾浠栨満瀛愪竴鏍峰彲浠ヨ繍琛?br />
嫻嬭瘯浠g爜
public static void main(String[] args) {
HelloRemote helloRemote =(HelloRemote)EJBFactory.getEJB("HelloRemoteService/remote");
for(int i=0;i<10;i++){
helloRemote.getString(i);
}
}
}
榪愯嫻嬭瘯浠g爜鎴戦棬鍙互鍙戠幇鍦?鍙版湇鍔″櫒涓婁粬浼氭墦鍗板嚭緇撴灉.榪欐槸JBOSS鑷繁鐨勮礋杞藉鉤琛″姛鑳藉府鍔╂垜闂ㄥ疄鐜扮殑,鍛靛懙鍐欏畬浜?榪欑畝鍗曠殑瀹炵幇鎴戦儊闂蜂簡2涓湀,閮侀椃~~~鍛靛懙甯屾湜鑳界粰鐮旂┒EJB3闆嗙兢鐨勬湅鍙嬩竴鐐瑰府鍔?br />
QQ58194033鏈夐棶棰樻垜闂ㄥ彲浠ョ戶緇帰璁?/p>
public class ManyShenpiIssue extends TestCase {
public void testIssueDefinition() throws FileNotFoundException
{
//浠嶫BPM.CFG.XML鍙栧緱JBPM閰嶇疆
JbpmConfiguration config = JbpmConfiguration.getInstance();
//鍒涘緩涓涓狫BPM瀹瑰櫒
JbpmContext jbpmContext = config.createJbpmContext();
//鐢眕rocessdefinition.xml鐢熸垚鎯沖搴旂殑嫻佺▼瀹氫箟綾籶rocessDefinition
InputStream is = new FileInputStream("process/shenpi/processdefinition.xml");
ProcessDefinition processDefinition = ProcessDefinition.parseXmlInputStream(is);
//鍒╃敤瀹瑰櫒鐨勬柟娉曞皢嫻佺▼瀹氫箟鏁版嵁閮ㄧ講鍦ㄦ暟鎹簱涓?/span>
jbpmContext.deployProcessDefinition(processDefinition);
//鍏抽棴jbpmContext
jbpmContext.close();
}
}
宸ヤ綔嫻佸湪鐫灝辯畻鍙戝竷瀹屾垚浜?寰堢畝鍗曞涓嶅鍛
鐜板湪澶у瀵瑰紩鎿庣殑姒傚康榪樻槸寰堟ā緋婂涓嶅,娌′簨涓嬮潰鐨勫唴瀹規垜浼氬仛璇︾粏瑙i噴
@SuppressWarnings("serial")
@Entity
@Table(name="DictionaryCatalog")
public class DictionaryCatalogEntity implements Serializable {
private Integer catalogId;
private String catalogName;
private String cataMemo;
private DictionaryTypeEntity dte;
private Set<DirectoryData> dce;
@ManyToOne(cascade=CascadeType.ALL ,fetch=FetchType.LAZY,optional=false)
@JoinColumn(name="id")
public DictionaryTypeEntity getDte() {
return dte;
}
public void setDte(DictionaryTypeEntity dte) {
this.dte = dte;
}
@OneToMany(cascade=CascadeType.ALL ,fetch=FetchType.LAZY,mappedBy="dataId")
@OrderBy(value="dataId desc")
public Set<DirectoryData> getDce() {
return dce;
}
public void setDce(Set<DirectoryData> dce) {
this.dce = dce;
}
@Id
@GeneratedValue
public Integer getCatalogId() {
return catalogId;
}
public void setCatalogId(Integer catalogId) {
this.catalogId = catalogId;
}
@Column(name="catalogName" , nullable=true ,length=50)
public String getCatalogName() {
return catalogName;
}
public void setCatalogName(String catalogName) {
this.catalogName = catalogName;
}
@Column(name="cataMemo" ,nullable=true ,length=50)
public String getCataMemo() {
return cataMemo;
}
public void setCataMemo(String cataMemo) {
this.cataMemo = cataMemo;
}
}
鍛靛懙榪炴暟鎹簱閮借嚜宸辯敓鎴愪簡,浣犻棬璇撮叿涓?/p>
瀹屼簡鏄細璇滲EAN
@Stateless
@Remote ({QueryDAO.class})
public class QueryDAOBean implements QueryDAO {
@PersistenceContext
protected EntityManager em;
public void initdate() {
Query query = em.createQuery("select count(p) from Person p");
Object result = query.getSingleResult();
if (result == null || Integer.parseInt(result.toString()) == {
}
鏌ヨ鍩烘湰鏄笂鏄啓瀹屼簡,鐪嬫槸涓嶆槸寰堢被浼糎IBERNATE鐨勬煡璇㈣璦鍛靛懙,浣嗘槸EJB鍙堝皝瑁呬簡鍝堬紝鐜板湪EJB緇堜簬鍙互鍜孲PRING鎯蟲姉琛′簡鍝?鍛靛懙)
(姝や緥瀛?涓被娌℃湁浠諱綍鍏崇郴,鎵浠ュぇ瀹剁湅鐪嬪浣曞啓灝卞ソ鍜?鍛靛懙.鍚庨潰鎴戜細鍐欎釜渚嬪瓙璁╁ぇ瀹跺弬鑰冪殑)