mdbstruct.java
来自「一个java 代码生成器」· Java 代码 · 共 165 行
JAVA
165 行
/**
* Copyright (c) 2002, Siddhartha P. Chandurkar siddhartha@visioncodified.com
* All rights reserved.
* Licensed under the Academic Free License version 1.1
* See the file LICENSE.TXT for details.
* LICENSE.txt is located in the directory <install-directory>\Jenerator
* of your Jenertaor Installation.
*
*/
package com.jenerator.struct.ejb;
//<Imports>
import org.apache.log4j.Logger;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
//</Imports>
/**
* MDBStruct
*
* @author Siddhartha P. Chandurkar
* @version 0.9.0
*/
public class MDBStruct extends EjbStruct {
//ATTRIBUTES
private String messageSelector;
private String transactionType;
private String acknowledgeMode;
private String destination;
private String subscriptionDurability;
private static Logger log = Logger.getLogger(MDBStruct.class.getName());
//CONSTRUCTORS
public MDBStruct() {
}
//METHODS
//Accessor and Mutator methods
public String getMessageSelector() {
return messageSelector;
}
public String getTransactionType() {
return transactionType;
}
public String getAcknowledgeMode() {
return acknowledgeMode;
}
public String getDestination() {
return destination;
}
public void setMessageSelector(String _msgSelector) {
messageSelector = _msgSelector;
}
public void setTransactionType(String _transType) {
transactionType = _transType;
}
public void setAcknowledgeMode(String _ackMode) {
acknowledgeMode = _ackMode;
}
public void setDestination(String _destination) {
destination = _destination;
}
public String getSubscriptionDurability() {
return subscriptionDurability;
}
public void setSubscriptionDurability(String subscriptionDurability) {
this.subscriptionDurability = subscriptionDurability;
}
/**
* toXml
*/
public String toXml() {
StringBuffer xmlBuffer = new StringBuffer();
xmlBuffer.append("<?xml version='1.0'?>");
xmlBuffer.append("<message-driven-bean>");
xmlBuffer.append("<package>");
xmlBuffer.append(super.getPackageName());
xmlBuffer.append("</package>");
Vector imports = super.getImports();
if (imports.size() > 0) {
xmlBuffer.append("<imports>");
for (int i = 0; i < imports.size(); i++) {
xmlBuffer.append("<import>");
xmlBuffer.append(imports.elementAt(i));
xmlBuffer.append("</import>");
}
xmlBuffer.append("</imports>");
}
xmlBuffer.append("<ejb-name>");
xmlBuffer.append(super.getBeanName());
xmlBuffer.append("</ejb-name>");
xmlBuffer.append("<ejb-class>");
xmlBuffer.append(super.getEjbClass());
xmlBuffer.append("</ejb-class>");
Vector attributes = super.getAttributes();
xmlBuffer.append("<attributes>");
for (int m = 0; m < attributes.size(); m++) {
AttributeStruct attrStruct = (AttributeStruct) attributes.elementAt(m);
xmlBuffer.append("<attribute name=\"" + attrStruct.getOriginalName() + "\" type=\"" + attrStruct.getType() + "\">");
xmlBuffer.append(attrStruct.getName());
xmlBuffer.append("</attribute>");
}
xmlBuffer.append("</attributes>");
Hashtable methodSigs = super.getMethodSignatures();
if (!methodSigs.isEmpty()) {
Enumeration keys = methodSigs.keys();
xmlBuffer.append("<methods>");
while (keys.hasMoreElements()) {
xmlBuffer.append("<method>");
String signature = keys.nextElement().toString();
String exceptions = methodSigs.get(signature).toString();
xmlBuffer.append("<signature>");
xmlBuffer.append(signature.toString());
xmlBuffer.append("</signature>");
xmlBuffer.append("<exceptions>");
xmlBuffer.append(exceptions.toString());
xmlBuffer.append("</exceptions>");
xmlBuffer.append("</method>");
}
xmlBuffer.append("</methods>");
}
xmlBuffer.append("<message-selector>");
xmlBuffer.append(messageSelector);
xmlBuffer.append("</message-selector>");
xmlBuffer.append("<transaction-type>");
xmlBuffer.append(transactionType);
xmlBuffer.append("</transaction-type>");
xmlBuffer.append("<acknowledge-mode>");
xmlBuffer.append(acknowledgeMode);
xmlBuffer.append("</acknowledge-mode>");
xmlBuffer.append("<message-driven-destination>");
xmlBuffer.append("<destination-type>");
xmlBuffer.append(destination);
xmlBuffer.append("</destination-type>");
xmlBuffer.append("<subscription-durability>");
xmlBuffer.append(subscriptionDurability);
xmlBuffer.append("</subscription-durability>");
xmlBuffer.append("</message-driven-destination>");
xmlBuffer.append("<jndi-name>" + super.getJndiName() + "</jndi-name>");
xmlBuffer.append("<unit-test-framework>" + super.getUnitTestingFramework() + "</unit-test-framework>");
xmlBuffer.append("</message-driven-bean>");
return xmlBuffer.toString();
}//toXml
}//MDBStruct
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?