User: oberg
Date: 00/05/30 11:32:25
Modified: src/main/org/jboss/ejb/plugins/jaws/deployment
JawsCMPField.java JawsEjbJar.java
JawsEnterpriseBeans.java JawsEntity.java
JawsFileManager.java TypeMapping.java
TypeMappings.java
Added: src/main/org/jboss/ejb/plugins/jaws/deployment
JawsEjbJarViewer.java JawsEntityViewer.java
Log:
Major update. Too much to mention.
Revision Changes Path
1.4 +9 -8
jboss/src/main/org/jboss/ejb/plugins/jaws/deployment/JawsCMPField.java
Index: JawsCMPField.java
===================================================================
RCS file:
/products/cvs/ejboss/jboss/src/main/org/jboss/ejb/plugins/jaws/deployment/JawsCMPField.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- JawsCMPField.java 2000/05/28 19:41:26 1.3
+++ JawsCMPField.java 2000/05/30 18:32:23 1.4
@@ -23,7 +23,7 @@
* @see <related>
* @author Rickard �berg ([EMAIL PROTECTED])
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
*/
public class JawsCMPField
extends com.dreambean.ejx.ejb.CMPField
@@ -80,7 +80,7 @@
java.lang.reflect.Field type = clazz.getField(getFieldName());
// Retrieve the sql type from Mapping defaults
- sqlType =
((JawsEjbJar)getBeanContext().getBeanContext().getBeanContext()).getTypeMappings().getTypeMapping(((JawsEnterpriseBeans)getBeanContext().getBeanContext()).getTypeMapping()).getSqlTypeForJavaType(type.getType(),
(JawsEntity)getBeanContext());
+ sqlType =
((JawsEjbJar)getBeanContext().getBeanContext().getBeanContext()).getTypeMappings().getTypeMapping(((JawsEjbJar)getBeanContext().getBeanContext().getBeanContext()).getTypeMapping()).getSqlTypeForJavaType(type.getType(),
(JawsEntity)getBeanContext());
return sqlType;
}
@@ -124,7 +124,7 @@
// Go get the default from jawsDefault
// If there is no database in JawsEnterpriseBeans we use
default Mappings
- jdbcType =
((JawsEjbJar)getBeanContext().getBeanContext().getBeanContext()).getTypeMappings().getTypeMapping(((JawsEnterpriseBeans)getBeanContext().getBeanContext()).getTypeMapping()).getJdbcTypeForJavaType(type.getType(),
(JawsEntity)getBeanContext());
+ jdbcType =
((JawsEjbJar)getBeanContext().getBeanContext().getBeanContext()).getTypeMappings().getTypeMapping(((JawsEjbJar)getBeanContext().getBeanContext().getBeanContext()).getTypeMapping()).getJdbcTypeForJavaType(type.getType(),
(JawsEntity)getBeanContext());
return jdbcType;
}
@@ -163,8 +163,6 @@
public void importXml(Element elt)
{
-
((JawsEnterpriseBeans)getBeanContext().getBeanContext()).addPropertyChangeListener("TypeMapping",
this);
-
if
(elt.getOwnerDocument().getDocumentElement().getTagName().equals(JawsEjbJar.JAWS_DOCUMENT))
{
NodeList nl = elt.getChildNodes();
@@ -209,11 +207,11 @@
Class clazz =
cl.loadClass(((JawsEntity)getBeanContext()).getEjbClass());
java.lang.reflect.Field type = clazz.getField(getFieldName());
- String sql =
((JawsEjbJar)getBeanContext().getBeanContext().getBeanContext()).getTypeMappings().getTypeMapping(((JawsEnterpriseBeans)getBeanContext().getBeanContext()).getTypeMapping()).getSqlTypeForJavaType(type.getType(),
(JawsEntity)getBeanContext());
+ String sql =
((JawsEjbJar)getBeanContext().getBeanContext().getBeanContext()).getTypeMappings().getTypeMapping(((JawsEjbJar)getBeanContext().getBeanContext().getBeanContext()).getTypeMapping()).getSqlTypeForJavaType(type.getType(),
(JawsEntity)getBeanContext());
if (sql != null)
setSqlType(sql);
- String jdbc =
((JawsEjbJar)getBeanContext().getBeanContext().getBeanContext()).getTypeMappings().getTypeMapping(((JawsEnterpriseBeans)getBeanContext().getBeanContext()).getTypeMapping()).getJdbcTypeForJavaType(type.getType(),
(JawsEntity)getBeanContext());
+ String jdbc =
((JawsEjbJar)getBeanContext().getBeanContext().getBeanContext()).getTypeMappings().getTypeMapping(((JawsEjbJar)getBeanContext().getBeanContext().getBeanContext()).getTypeMapping()).getJdbcTypeForJavaType(type.getType(),
(JawsEntity)getBeanContext());
if (jdbc != null)
setJdbcType(jdbc);
@@ -228,7 +226,10 @@
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
-
+ protected void initializeBeanContextResources()
+ {
+
((JawsEjbJar)getBeanContext().getBeanContext().getBeanContext()).addPropertyChangeListener("TypeMapping",
this);
+ }
// Private -------------------------------------------------------
// Inner classes -------------------------------------------------
1.3 +50 -2
jboss/src/main/org/jboss/ejb/plugins/jaws/deployment/JawsEjbJar.java
Index: JawsEjbJar.java
===================================================================
RCS file:
/products/cvs/ejboss/jboss/src/main/org/jboss/ejb/plugins/jaws/deployment/JawsEjbJar.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- JawsEjbJar.java 2000/05/28 19:43:01 1.2
+++ JawsEjbJar.java 2000/05/30 18:32:23 1.3
@@ -27,7 +27,7 @@
*
* @see <related>
* @author Rickard �berg ([EMAIL PROTECTED])
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class JawsEjbJar
extends com.dreambean.ejx.ejb.EjbJar
@@ -36,7 +36,12 @@
public static final String JAWS_DOCUMENT="jaws";
// Attributes ----------------------------------------------------
+ String dataSource = "Hypersonic";
+ String typeMapping = "Hypersonic SQL";
+
TypeMappings tm;
+
+ Customizer c;
// Static --------------------------------------------------------
@@ -50,14 +55,51 @@
}
// Public --------------------------------------------------------
+ public void setDataSource(String ds)
+ {
+ dataSource = ds;
+ }
+
+ public String getDataSource()
+ {
+ return dataSource;
+ }
+
+ public void setTypeMapping(String tm)
+ {
+ String old = typeMapping;
+ typeMapping = tm;
+ firePropertyChange("TypeMapping", old, typeMapping);
+ }
+
+ public String getTypeMapping()
+ {
+ return typeMapping;
+ }
+
public TypeMappings getTypeMappings() { return tm; }
+ // BeanContextChildComponentProxy implementation -----------------
+ public java.awt.Component getComponent()
+ {
+ if (c == null)
+ {
+ c = new JawsEjbJarViewer();
+ c.setObject(this);
+ }
+
+ return (java.awt.Component)c;
+ }
+
// XmlExternalizable implementation ------------------------------
public Element exportXml(Document doc)
throws Exception
{
Element ejbjar = doc.createElement(JAWS_DOCUMENT);
+ XMLManager.addElement(ejbjar,"datasource",dataSource);
+ XMLManager.addElement(ejbjar,"type-mapping",getTypeMapping());
+
ejbjar.appendChild(tm.exportXml(doc));
ejbjar.appendChild(eb.exportXml(doc));
@@ -81,7 +123,13 @@
} else if (name.equals("type-mappings"))
{
tm.importXml((Element)n);
- }
+ } else if (name.equals("datasource"))
+ {
+ setDataSource(n.hasChildNodes() ? XMLManager.getString(n) : "");
+ } else if (name.equals("type-mapping"))
+ {
+ setTypeMapping(n.hasChildNodes() ?
XMLManager.getString(n) : "");
+ }
}
} else
{
1.3 +3 -36
jboss/src/main/org/jboss/ejb/plugins/jaws/deployment/JawsEnterpriseBeans.java
Index: JawsEnterpriseBeans.java
===================================================================
RCS file:
/products/cvs/ejboss/jboss/src/main/org/jboss/ejb/plugins/jaws/deployment/JawsEnterpriseBeans.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- JawsEnterpriseBeans.java 2000/05/28 19:43:01 1.2
+++ JawsEnterpriseBeans.java 2000/05/30 18:32:24 1.3
@@ -28,7 +28,7 @@
* @see <related>
* @author Rickard �berg ([EMAIL PROTECTED])
* @author <a href="[EMAIL PROTECTED]">Marc Fleury</a>
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class JawsEnterpriseBeans
extends com.dreambean.ejx.ejb.EnterpriseBeans
@@ -36,39 +36,13 @@
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
- String dataSource = "";
- String typeMapping = "";
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
// Public --------------------------------------------------------
- public void setDataSource(String ds) { dataSource = ds; }
- public String getDataSource() { return dataSource; }
- public void setTypeMapping(String tm) { String old = typeMapping; typeMapping =
tm; firePropertyChange("TypeMapping", old, typeMapping); }
-
- /*
- * getTypeMapping()
- *
- * If no type mapping is specified (no jaws.xml file provided) we use the default
- * Hypersonic default database settings
- *
- */
- public String getTypeMapping() {
-
- if (!typeMapping.equals("")) {
-
- // We have a specified typeMapping either from XML or default
- return typeMapping;
- }
- else {
-
- return "Hypersonic SQL";
- }
- }
-
public com.dreambean.ejx.ejb.Entity addEntity()
throws IOException, ClassNotFoundException
{
@@ -80,10 +54,9 @@
throws Exception
{
Element enterprisebeans = super.exportXml(doc);
-
- XMLManager.addElement(enterprisebeans,"datasource",dataSource);
- XMLManager.addElement(enterprisebeans,"type-mapping",getTypeMapping());
+ // No settings
+
return enterprisebeans;
}
@@ -112,12 +85,6 @@
// e.printStackTrace();
// Does not exist anymore...
}
- } else if (name.equals("datasource"))
- {
- setDataSource(n.hasChildNodes() ? XMLManager.getString(n) : "");
- } else if (name.equals("type-mapping"))
- {
- setTypeMapping(n.hasChildNodes() ? XMLManager.getString(n)
: "");
}
}
} else
1.2 +20 -16
jboss/src/main/org/jboss/ejb/plugins/jaws/deployment/JawsEntity.java
Index: JawsEntity.java
===================================================================
RCS file:
/products/cvs/ejboss/jboss/src/main/org/jboss/ejb/plugins/jaws/deployment/JawsEntity.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JawsEntity.java 2000/05/19 07:11:56 1.1
+++ JawsEntity.java 2000/05/30 18:32:24 1.2
@@ -22,16 +22,18 @@
import com.dreambean.ejx.xml.XmlExternalizable;
import com.dreambean.ejx.Util;
import com.dreambean.ejx.ejb.EjbReference;
+import com.dreambean.ejx.ejb.CMPField;
/**
* <description>
*
* @see <related>
* @author Rickard �berg ([EMAIL PROTECTED])
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
public class JawsEntity
extends com.dreambean.ejx.ejb.Entity
+ implements BeanContextContainerProxy
{
// Constants -----------------------------------------------------
@@ -43,7 +45,7 @@
boolean readOnly = false;
int timeOut = 5*60; // 5 minute timeout on read-only state
- Container c;
+ Customizer c;
// Static --------------------------------------------------------
@@ -71,9 +73,15 @@
public com.dreambean.ejx.ejb.CMPField addCMPField()
throws Exception
{
- return
(com.dreambean.ejx.ejb.CMPField)instantiateChild("org.jboss.ejb.plugins.jaws.deployment.JawsCMPField");
+ return
(CMPField)instantiateChild("org.jboss.ejb.plugins.jaws.deployment.JawsCMPField");
}
+ public EjbReference addEjbReference()
+ throws Exception
+ {
+ return
(EjbReference)instantiateChild("org.jboss.ejb.plugins.jaws.deployment.JawsEjbReference");
+ }
+
public Finder addFinder()
throws Exception
{
@@ -85,23 +93,19 @@
return Util.getChildrenByClass(iterator(),Finder.class);
}
- // BeanContextContainerProxy implementation -----------------
+ public Iterator iterator()
+ {
+ // Don't show children
+ return new ArrayList().iterator();
+ }
+
+ // BeanContextChildComponentProxy implementation -----------------
public Container getContainer()
{
if (c == null)
{
- c = new JTabbedPane();
- c.add(new GenericCustomizer(this), "Entity");
-
- try
- {
- c.add(new GenericPropertySheet(this, JawsCMPField.class), "CMP
mappings");
- } catch (Exception e) {}
-
- try
- {
- c.add(new GenericPropertySheet(this, Finder.class), "Finders");
- } catch (Exception e) {}
+ c = new JawsEntityViewer();
+ c.setObject(this);
}
return (Container)c;
}
1.5 +2 -4
jboss/src/main/org/jboss/ejb/plugins/jaws/deployment/JawsFileManager.java
Index: JawsFileManager.java
===================================================================
RCS file:
/products/cvs/ejboss/jboss/src/main/org/jboss/ejb/plugins/jaws/deployment/JawsFileManager.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- JawsFileManager.java 2000/05/28 19:43:01 1.4
+++ JawsFileManager.java 2000/05/30 18:32:24 1.5
@@ -30,7 +30,7 @@
*
* @see <related>
* @author Rickard �berg ([EMAIL PROTECTED])
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
*/
public class JawsFileManager
extends BeanContextServicesSupport
@@ -207,7 +207,6 @@
// Load default Jaws XML
InputStream jawsXml = getClass().getResourceAsStream("defaultjaws.xml");
- System.out.println("Loading default XML");
if (jawsXml != null)
{
try
@@ -275,7 +274,6 @@
ByteArrayOutputStream out = new ByteArrayOutputStream();
Writer w = new OutputStreamWriter(out);
- System.out.println(doc+"#"+w);
xm.save(doc,w);
w.close();
byte[] arr = out.toByteArray();
@@ -327,7 +325,7 @@
{
if (comp == null)
{
- comp = new BeanContextPanel(ejbJar,"JAWS XML");
+ comp = ejbJar.getComponent();
}
return comp;
}
1.3 +3 -3
jboss/src/main/org/jboss/ejb/plugins/jaws/deployment/TypeMapping.java
Index: TypeMapping.java
===================================================================
RCS file:
/products/cvs/ejboss/jboss/src/main/org/jboss/ejb/plugins/jaws/deployment/TypeMapping.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TypeMapping.java 2000/05/19 07:11:56 1.2
+++ TypeMapping.java 2000/05/30 18:32:24 1.3
@@ -32,7 +32,7 @@
*
* @see <related>
* @author Rickard �berg ([EMAIL PROTECTED])
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class TypeMapping
extends BeanContextServicesSupport
@@ -90,8 +90,8 @@
return ref.getName();
}
}
- }
- } catch (Exception e)
+ }
+ } catch (Exception e)
{
e.printStackTrace();
}
1.3 +7 -3
jboss/src/main/org/jboss/ejb/plugins/jaws/deployment/TypeMappings.java
Index: TypeMappings.java
===================================================================
RCS file:
/products/cvs/ejboss/jboss/src/main/org/jboss/ejb/plugins/jaws/deployment/TypeMappings.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TypeMappings.java 2000/05/19 07:11:56 1.2
+++ TypeMappings.java 2000/05/30 18:32:24 1.3
@@ -17,7 +17,7 @@
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import com.dreambean.awt.GenericCustomizer;
+import com.dreambean.awt.BeanContextViewer;
import com.dreambean.ejx.xml.XMLManager;
import com.dreambean.ejx.xml.XmlExternalizable;
import com.dreambean.ejx.Util;
@@ -27,7 +27,7 @@
*
* @see <related>
* @author Rickard �berg ([EMAIL PROTECTED])
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class TypeMappings
extends BeanContextSupport
@@ -73,7 +73,11 @@
public Component getComponent()
{
if (c == null)
- c = new GenericCustomizer(this);
+ {
+ c = new BeanContextViewer();
+ c.setObject(this);
+ }
+
return (Component)c;
}
1.1
jboss/src/main/org/jboss/ejb/plugins/jaws/deployment/JawsEjbJarViewer.java
Index: JawsEjbJarViewer.java
===================================================================
/*
* Copyright 1999 by dreamBean Software,
* All rights reserved.
*/
package org.jboss.ejb.plugins.jaws.deployment;
import java.beans.Customizer;
import com.dreambean.awt.GenericCustomizer;
/**
* <description>
*
* @see <related>
* @author Rickard Oberg ([EMAIL PROTECTED])
* @version $Revision: 1.1 $
*/
public class JawsEjbJarViewer
extends com.dreambean.ejx.ejb.EjbJarViewer
implements Customizer
{
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
// Customizer implementation ------------------------------------
public void setObject(Object obj)
{
super.setObject(obj);
// Remove assembler descriptor tab
removeTabAt(indexOfTab("Assembly descriptor"));
JawsEjbJar ejbJar = (JawsEjbJar)obj;
// Init UI
addTab("Type mappings", ejbJar.getTypeMappings().getComponent());
}
}
1.1
jboss/src/main/org/jboss/ejb/plugins/jaws/deployment/JawsEntityViewer.java
Index: JawsEntityViewer.java
===================================================================
/*
* Copyright 1999 by dreamBean Software,
* All rights reserved.
*/
package org.jboss.ejb.plugins.jaws.deployment;
import java.beans.Customizer;
import java.beans.beancontext.BeanContext;
import javax.swing.JTabbedPane;
import com.dreambean.awt.GenericCustomizer;
import com.dreambean.awt.GenericPropertySheet;
/**
* <description>
*
* @see <related>
* @author Rickard Oberg ([EMAIL PROTECTED])
* @version $Revision: 1.1 $
*/
public class JawsEntityViewer
extends JTabbedPane
implements Customizer
{
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
// Customizer implementation ------------------------------------
public void setObject(Object obj)
{
// Init UI
addTab("Entity", new GenericCustomizer(false, obj));
try
{
addTab("CMP mappings", new GenericPropertySheet((BeanContext)obj,
JawsCMPField.class));
} catch (Exception e) {}
try
{
addTab("Finders", new GenericPropertySheet((BeanContext)obj,
Finder.class));
} catch (Exception e) {}
}
}