Update of
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-ejb/src/main/java/org/xdoclet/plugin/ejb/descriptor
In directory
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12844/plugin-ejb/src/main/java/org/xdoclet/plugin/ejb/descriptor
Modified Files:
relationships.jelly EjbJarXmlPlugin.java ejb-ref.jelly
Log Message:
* Various refactorings
* Completed ValueObjectPlugin
Index: relationships.jelly
===================================================================
RCS file:
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-ejb/src/main/java/org/xdoclet/plugin/ejb/descriptor/relationships.jelly,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** relationships.jelly 26 Aug 2005 17:52:30 -0000 1.1
--- relationships.jelly 13 Dec 2005 03:35:32 -0000 1.2
***************
*** 1,5 ****
<j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml">
<j:if test="${version.greaterOrEquals(2.0)}">
! <j:set var="relations" value="${util.getRelationships(metadata)}"/>
<j:choose>
<j:when test="${!empty(relations) or
plugin.getMergeFile('relationships.xml', class).exists()}">
--- 1,5 ----
<j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml">
<j:if test="${version.greaterOrEquals(2.0)}">
! <j:set var="relations" value="${plugin.getRelationships(metadata)}"/>
<j:choose>
<j:when test="${!empty(relations) or
plugin.getMergeFile('relationships.xml', class).exists()}">
Index: EjbJarXmlPlugin.java
===================================================================
RCS file:
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-ejb/src/main/java/org/xdoclet/plugin/ejb/descriptor/EjbJarXmlPlugin.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** EjbJarXmlPlugin.java 11 Oct 2005 09:22:26 -0000 1.15
--- EjbJarXmlPlugin.java 13 Dec 2005 03:35:32 -0000 1.16
***************
*** 10,28 ****
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
import org.generama.JellyTemplateEngine;
import org.generama.QDoxCapableMetadataProvider;
import org.generama.WriterMapper;
- import org.generama.defaults.QDoxPlugin;
import org.generama.defaults.XMLOutputValidator;
import org.xdoclet.plugin.ejb.EjbConfig;
import org.xdoclet.plugin.ejb.EjbIds;
import org.xdoclet.plugin.ejb.EjbRuntime;
- import org.xdoclet.plugin.ejb.EjbUtils;
import org.xdoclet.plugin.ejb.EjbVersion;
import org.xdoclet.plugin.ejb.entity.PrimaryKeyClassPlugin;
import org.xdoclet.plugin.ejb.interfaces.LocalHomeInterfacePlugin;
--- 10,35 ----
import java.text.MessageFormat;
+ import java.util.Arrays;
+ import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
+ import org.apache.commons.collections.CollectionUtils;
+ import org.apache.commons.collections.Transformer;
+
import org.generama.JellyTemplateEngine;
import org.generama.QDoxCapableMetadataProvider;
import org.generama.WriterMapper;
import org.generama.defaults.XMLOutputValidator;
+ import org.xdoclet.plugin.ejb.EjbBeanResolver;
import org.xdoclet.plugin.ejb.EjbConfig;
import org.xdoclet.plugin.ejb.EjbIds;
+ import org.xdoclet.plugin.ejb.EjbQDoxPlugin;
import org.xdoclet.plugin.ejb.EjbRuntime;
import org.xdoclet.plugin.ejb.EjbVersion;
+ import org.xdoclet.plugin.ejb.Relation;
+ import org.xdoclet.plugin.ejb.RelationManager;
import org.xdoclet.plugin.ejb.entity.PrimaryKeyClassPlugin;
import org.xdoclet.plugin.ejb.interfaces.LocalHomeInterfacePlugin;
***************
*** 31,37 ****
import org.xdoclet.plugin.ejb.interfaces.RemoteInterfacePlugin;
import org.xdoclet.plugin.ejb.interfaces.ServiceEndpointPlugin;
! import org.xdoclet.plugin.ejb.qtags.TagLibrary;
import com.thoughtworks.qdox.model.JavaClass;
/**
--- 38,45 ----
import org.xdoclet.plugin.ejb.interfaces.RemoteInterfacePlugin;
import org.xdoclet.plugin.ejb.interfaces.ServiceEndpointPlugin;
! import org.xdoclet.plugin.ejb.util.QDoxCachedMetadataProvider;
import com.thoughtworks.qdox.model.JavaClass;
+ import com.thoughtworks.qdox.model.JavaMethod;
/**
***************
*** 40,45 ****
* @version $Revision$
*/
! public class EjbJarXmlPlugin extends QDoxPlugin {
! private EjbUtils ejbUtils;
private String description;
private String displayname;
--- 48,52 ----
* @version $Revision$
*/
! public class EjbJarXmlPlugin extends EjbQDoxPlugin {
private String description;
private String displayname;
***************
*** 47,58 ****
private String largeicon;
private boolean useids = true;
-
- /** Directory of merge file(s) */
- private File mergeDir;
-
/** Default name for generated file */
private String fileName = "ejb-jar.xml";
private String clientjar;
! private EjbConfig config;
// DONE: Pending fix to be applied:
http://issues.apache.org/jira/browse/JELLY-213
--- 54,61 ----
private String largeicon;
private boolean useids = true;
/** Default name for generated file */
private String fileName = "ejb-jar.xml";
private String clientjar;
! private EjbBeanResolver beanResolver = null;
// DONE: Pending fix to be applied:
http://issues.apache.org/jira/browse/JELLY-213
***************
*** 63,75 ****
// DONE: EjbRuntimeSingleton instead of EjbUtils.get(config);
public EjbJarXmlPlugin(JellyTemplateEngine jellyTemplateEngine,
QDoxCapableMetadataProvider metadataProvider,
! WriterMapper writerMapper, EjbConfig config) throws
ClassNotFoundException {
! super(jellyTemplateEngine, metadataProvider, writerMapper);
EjbRuntime.setPlugin(this);
Map dtds = EjbVersion.fillEntityResolverMap(new HashMap());
super.setMultioutput(false);
setOutputValidator(new XMLOutputValidator(dtds));
- this.ejbUtils = new EjbUtils();
- this.config = config;
- new TagLibrary(metadataProvider);
}
--- 66,75 ----
// DONE: EjbRuntimeSingleton instead of EjbUtils.get(config);
public EjbJarXmlPlugin(JellyTemplateEngine jellyTemplateEngine,
QDoxCapableMetadataProvider metadataProvider,
! WriterMapper writerMapper, EjbConfig config) {
! super(jellyTemplateEngine, new
QDoxCachedMetadataProvider(metadataProvider), writerMapper, config);
EjbRuntime.setPlugin(this);
Map dtds = EjbVersion.fillEntityResolverMap(new HashMap());
super.setMultioutput(false);
setOutputValidator(new XMLOutputValidator(dtds));
}
***************
*** 103,137 ****
/**
- * Setter for mergeDir property
- *
- * @param mergeDir The value for the property
- */
- public void setMergedir(File mergeDir) {
- this.mergeDir = mergeDir;
- }
-
- /**
- * Utility method called from jelly script to resolve a mergeFile
reference
- *
- * @param mergeFile The mergeFile to look for
- *
- * @return A File for mergeFile
- */
- public File getMergeFile(String mergeFile) {
- if ((mergeFile != null) && (mergeDir != null) &&
mergeDir.isDirectory()) {
- // The listing of mergeDir's files avoid possibly security issues
in path resolving (paranoid?)
- File[] files = mergeDir.listFiles();
-
- for (int i = 0; i < files.length; i++) {
- if (mergeFile.trim().equals(files[i].getName())) {
- return files[i];
- }
- }
- }
-
- return null;
- }
-
- /**
* Utility method called from jelly script to resolve a mergeFile
reference
*
--- 103,106 ----
***************
*** 149,169 ****
}
! public EjbConfig getConfig() {
! return config;
! }
!
! public EjbVersion getVersion() {
! return getConfig().getEjbVersion();
! }
!
! public EjbUtils getEjbUtils() {
! return ejbUtils;
! }
!
! public LocalInterfacePlugin getLocalInterfacePlugin() throws
ClassNotFoundException {
return EjbRuntime.getLocalInterfacePlugin();
}
! public RemoteInterfacePlugin getRemoteInterfacePlugin() throws
ClassNotFoundException {
return EjbRuntime.getRemoteInterfacePlugin();
}
--- 118,126 ----
}
! public LocalInterfacePlugin getLocalInterfacePlugin() {
return EjbRuntime.getLocalInterfacePlugin();
}
! public RemoteInterfacePlugin getRemoteInterfacePlugin() {
return EjbRuntime.getRemoteInterfacePlugin();
}
***************
*** 181,197 ****
}
! public LocalHomeInterfacePlugin getLocalHomeInterfacePlugin() throws
ClassNotFoundException {
return EjbRuntime.getLocalHomeInterfacePlugin();
}
! public RemoteHomeInterfacePlugin getRemoteHomeInterfacePlugin() throws
ClassNotFoundException {
return EjbRuntime.getRemoteHomeInterfacePlugin();
}
! public PrimaryKeyClassPlugin getPrimaryKeyClassPlugin() throws
ClassNotFoundException {
return EjbRuntime.getPrimaryKeyClassPlugin();
}
! public ServiceEndpointPlugin getServiceEndpointPlugin() throws
ClassNotFoundException {
return EjbRuntime.getServiceEndpointPlugin();
}
--- 138,164 ----
}
! public Collection getRelationships(Collection metadata) {
! RelationManager relationManager =
ejbUtils.createRelationManager(metadata);
! return
CollectionUtils.collect(Arrays.asList(relationManager.getRelations()),
! new Transformer() {
! public Object transform(Object arg0) {
! return new RelationHolder((Relation) arg0);
! }
! });
! }
!
! public LocalHomeInterfacePlugin getLocalHomeInterfacePlugin() {
return EjbRuntime.getLocalHomeInterfacePlugin();
}
! public RemoteHomeInterfacePlugin getRemoteHomeInterfacePlugin() {
return EjbRuntime.getRemoteHomeInterfacePlugin();
}
! public PrimaryKeyClassPlugin getPrimaryKeyClassPlugin() {
return EjbRuntime.getPrimaryKeyClassPlugin();
}
! public ServiceEndpointPlugin getServiceEndpointPlugin() {
return EjbRuntime.getServiceEndpointPlugin();
}
***************
*** 247,252 ****
public void start() {
setFilereplace(fileName);
! ejbUtils.cacheEjbs(getMetadata());
super.start();
}
! }
\ No newline at end of file
--- 214,285 ----
public void start() {
setFilereplace(fileName);
! beanResolver = ejbUtils.createEjbBeanResolver(getMetadata());
super.start();
}
!
! public JavaClass findEjbRef(String ejbName) {
! return ejbUtils.findEjbRef(ejbName, beanResolver);
! }
!
! public class RelationHolder {
! public final static String ONE = "One";
! public final static String MANY = "Many";
! private final Relation relation;
!
! public RelationHolder(Relation relation) {
! this.relation = relation;
! }
!
! public String getName() {
! return this.relation.getName();
! }
!
! public String getLeftRoleName() {
! return this.relation.getLeftRoleName();
! }
!
! public boolean isLeftCascadeDelete() {
! return this.relation.isLeftCascadeDelete();
! }
!
! public boolean isRightCascadeDelete() {
! return this.relation.isRightCascadeDelete();
! }
!
! public JavaMethod getLeftMethod() {
! return this.relation.getLeftMethod();
! }
!
! public JavaMethod getRightMethod() {
! return this.relation.getRightMethod();
! }
!
! public boolean isLeftMany() {
! return this.relation.isLeftMany();
! }
!
! public boolean isRightMany() {
! return this.relation.isRightMany();
! }
!
! public String getRightRoleName() {
! return this.relation.getRightRoleName();
! }
!
! public String getLeftEJBName() {
! return this.relation.getLeftEJBName();
! }
!
! public String getRightEJBName() {
! return this.relation.getRightEJBName();
! }
!
! public String getRightMultiplicity() {
! return this.relation.isRightMany() ? MANY : ONE;
! }
!
! public String getLeftMultiplicity() {
! return this.relation.isLeftMany() ? MANY : ONE;
! }
! }
! }
Index: ejb-ref.jelly
===================================================================
RCS file:
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-ejb/src/main/java/org/xdoclet/plugin/ejb/descriptor/ejb-ref.jelly,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ejb-ref.jelly 6 Oct 2005 13:46:48 -0000 1.3
--- ejb-ref.jelly 13 Dec 2005 03:35:32 -0000 1.4
***************
*** 1,79 ****
! <j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml">
! <j:forEach var="reference"
items="${util.findTagsByName(class,'ejb.ejb-ref')}">
! <j:set var="refTag" value="${reference.tag}"/>
! <j:set var="refClass" value="${util.findEjbRef(refTag.ejbName)}"/>
! <j:if test="${util.isRemoteEjbRef(refTag.viewType, refClass)}">
! <ejb-ref id="${plugin.prefixedId('EJBRef')}">
! <ejb-ref-name>${util.ejbRefName(reference,
refClass)}</ejb-ref-name>
! <ejb-ref-type>${util.beanType(refClass)}</ejb-ref-type>
!
<home>${plugin.remoteHomeInterfacePlugin.getVirtualType(refClass)}</home>
!
<remote>${plugin.remoteInterfacePlugin.getVirtualType(refClass)}</remote>
! <ejb-link>${refTag.ejbName}</ejb-link>
! </ejb-ref>
! </j:if>
! </j:forEach>
!
! <j:forEach var="reference"
items="${util.findTagsByName(class,'ejb.ejb-external-ref')}">
! <j:set var="refTag" value="${reference.tag}"/>
! <j:choose>
! <j:when test="${util.isRemoteEjbRef(refTag.viewType)}">
! <ejb-ref id="${plugin.prefixedId('EJBRef')}">
! <ejb-ref-name>${util.ejbRefName(reference)}</ejb-ref-name>
! <ejb-ref-type>${refTag.type}</ejb-ref-type>
! <home>${refTag.home}</home>
! <remote>${refTag.business}</remote>
! <j:if test="${!empty(refTag.link)}">
! <ejb-link>${refTag.link}</ejb-link>
! </j:if>
! </ejb-ref>
! </j:when>
! <j:when test="${util.isLocalEjbRef(refTag.viewType)}">
! <ejb-local-ref id="${plugin.prefixedId('EJBLocalRef')}">
! <ejb-ref-name>${util.ejbRefName(reference)}</ejb-ref-name>
! <ejb-ref-type>${refTag.type}</ejb-ref-type>
! <local-home>${refTag.home}</local-home>
! <local>${refTag.business}</local>
! <j:if test="${!empty(refTag.link)}">
! <ejb-link>${refTag.link}</ejb-link>
! </j:if>
! </ejb-local-ref>
! </j:when>
! </j:choose>
! </j:forEach>
!
! <j:forEach var="reference"
items="${util.findTagsByName(class,'ejb.ejb-ref')}">
! <j:set var="refTag" value="${reference.tag}"/>
! <j:set var="refClass" value="${util.findEjbRef(refTag.ejbName)}"/>
! <j:if test="${util.isLocalEjbRef(refTag.viewType, refClass)}">
! <ejb-local-ref id="${plugin.prefixedId('EJBLocalRef')}">
! <ejb-ref-name>${util.ejbRefName(reference,
refClass)}</ejb-ref-name>
! <ejb-ref-type>${util.beanType(refClass)}</ejb-ref-type>
!
<local-home>${plugin.localHomeInterfacePlugin.getVirtualType(refClass)}</local-home>
!
<local>${plugin.localInterfacePlugin.getVirtualType(refClass)}</local>
! <ejb-link>${refTag.ejbName}</ejb-link>
! </ejb-local-ref>
! </j:if>
! </j:forEach>
! <j:if test="${version.greaterOrEquals(2.1)}">
! <j:forEach var="reference"
items="${util.findTagsByName(class,'ejb.ejb-service-ref')}">
! <j:set var="servRefTag" value="${reference.tag}"/>
! <service-ref id="${plugin.prefixedId('EJBServiceRef')}">
! <j:if test="${!empty(servRefTag.description)}">
! <description>${servRefTag.description}</description>
! </j:if>
!
<service-ref-name>${util.refName(reference)}</service-ref-name>
!
<service-interface>${util.refType(reference)}</service-interface>
! <j:if test="${!empty(servRefTag.wsdlFileUri)}">
! <wsdl-file>${servRefTag.wsdlFileUri}</wsdl-file>
! </j:if>
! <j:if test="${!empty(servRefTag.jaxrpcMappingFile)}">
!
<jaxrpc-mapping-file>${servRefTag.jaxrpcMappingFile}</jaxrpc-mapping-file>
! </j:if>
! <j:if test="${!empty(servRefTag.wsdlFileUri) and
!empty(servRefTag.qname)}">
! <service-qname>${servRefTag.qname}</service-qname>
! </j:if>
! <x:comment>TODO: port-component-ref and handler are still
missing</x:comment>
! </service-ref>
! </j:forEach>
! </j:if>
</j:jelly>
\ No newline at end of file
--- 1,79 ----
! <j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml">
! <j:forEach var="reference"
items="${util.findTagsByName(class,'ejb.ejb-ref')}">
! <j:set var="refTag" value="${reference.tag}"/>
! <j:set var="refClass" value="${plugin.findEjbRef(refTag.ejbName)}"/>
! <j:if test="${util.isRemoteEjbRef(refTag.viewType, refClass)}">
! <ejb-ref id="${plugin.prefixedId('EJBRef')}">
! <ejb-ref-name>${util.ejbRefName(reference,
refClass)}</ejb-ref-name>
! <ejb-ref-type>${util.beanType(refClass)}</ejb-ref-type>
!
<home>${plugin.remoteHomeInterfacePlugin.getVirtualType(refClass)}</home>
!
<remote>${plugin.remoteInterfacePlugin.getVirtualType(refClass)}</remote>
! <ejb-link>${refTag.ejbName}</ejb-link>
! </ejb-ref>
! </j:if>
! </j:forEach>
!
! <j:forEach var="reference"
items="${util.findTagsByName(class,'ejb.ejb-external-ref')}">
! <j:set var="refTag" value="${reference.tag}"/>
! <j:choose>
! <j:when test="${util.isRemoteEjbRef(refTag.viewType)}">
! <ejb-ref id="${plugin.prefixedId('EJBRef')}">
! <ejb-ref-name>${util.ejbRefName(reference)}</ejb-ref-name>
! <ejb-ref-type>${refTag.type}</ejb-ref-type>
! <home>${refTag.home}</home>
! <remote>${refTag.business}</remote>
! <j:if test="${!empty(refTag.link)}">
! <ejb-link>${refTag.link}</ejb-link>
! </j:if>
! </ejb-ref>
! </j:when>
! <j:when test="${util.isLocalEjbRef(refTag.viewType)}">
! <ejb-local-ref id="${plugin.prefixedId('EJBLocalRef')}">
! <ejb-ref-name>${util.ejbRefName(reference)}</ejb-ref-name>
! <ejb-ref-type>${refTag.type}</ejb-ref-type>
! <local-home>${refTag.home}</local-home>
! <local>${refTag.business}</local>
! <j:if test="${!empty(refTag.link)}">
! <ejb-link>${refTag.link}</ejb-link>
! </j:if>
! </ejb-local-ref>
! </j:when>
! </j:choose>
! </j:forEach>
!
! <j:forEach var="reference"
items="${util.findTagsByName(class,'ejb.ejb-ref')}">
! <j:set var="refTag" value="${reference.tag}"/>
! <j:set var="refClass" value="${plugin.findEjbRef(refTag.ejbName)}"/>
! <j:if test="${util.isLocalEjbRef(refTag.viewType, refClass)}">
! <ejb-local-ref id="${plugin.prefixedId('EJBLocalRef')}">
! <ejb-ref-name>${util.ejbRefName(reference,
refClass)}</ejb-ref-name>
! <ejb-ref-type>${util.beanType(refClass)}</ejb-ref-type>
!
<local-home>${plugin.localHomeInterfacePlugin.getVirtualType(refClass)}</local-home>
!
<local>${plugin.localInterfacePlugin.getVirtualType(refClass)}</local>
! <ejb-link>${refTag.ejbName}</ejb-link>
! </ejb-local-ref>
! </j:if>
! </j:forEach>
! <j:if test="${version.greaterOrEquals(2.1)}">
! <j:forEach var="reference"
items="${util.findTagsByName(class,'ejb.ejb-service-ref')}">
! <j:set var="servRefTag" value="${reference.tag}"/>
! <service-ref id="${plugin.prefixedId('EJBServiceRef')}">
! <j:if test="${!empty(servRefTag.description)}">
! <description>${servRefTag.description}</description>
! </j:if>
!
<service-ref-name>${util.refName(reference)}</service-ref-name>
!
<service-interface>${util.refType(reference)}</service-interface>
! <j:if test="${!empty(servRefTag.wsdlFileUri)}">
! <wsdl-file>${servRefTag.wsdlFileUri}</wsdl-file>
! </j:if>
! <j:if test="${!empty(servRefTag.jaxrpcMappingFile)}">
!
<jaxrpc-mapping-file>${servRefTag.jaxrpcMappingFile}</jaxrpc-mapping-file>
! </j:if>
! <j:if test="${!empty(servRefTag.wsdlFileUri) and
!empty(servRefTag.qname)}">
! <service-qname>${servRefTag.qname}</service-qname>
! </j:if>
! <x:comment>TODO: port-component-ref and handler are still
missing</x:comment>
! </service-ref>
! </j:forEach>
! </j:if>
</j:jelly>
\ No newline at end of file
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
xdoclet-plugins-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xdoclet-plugins-commits