User: cgjung Date: 02/04/02 05:48:41 Added: jboss.net/testsuite/src/main/org/jboss/net/samples/store Address.java BusinessPartner.java Item.java Line.java Order.java Phone.java StateType.java StoreException.java Unit.java store.dfPackage Log: That is the alpha-version together with the .Net sample client I hacked together at JBossOne ;-) more to come. Revision Changes Path 1.1 contrib/jboss.net/testsuite/src/main/org/jboss/net/samples/store/Address.java Index: Address.java =================================================================== /* * JBoss, the OpenSource J2EE webOS * * Distributable under LGPL license. * See terms of license at gnu.org. */ // $Id: Address.java,v 1.1 2002/04/02 13:48:41 cgjung Exp $ package org.jboss.net.samples.store; import java.io.Serializable; /** * A dependent class. * <br> * <h3>Change History</h3> * <ul> * </ul> * @created 22.03.2002 * @author <a href="mailto:[EMAIL PROTECTED]">Christoph G. Jung</a> * @version $Revision: 1.1 $ */ public class Address implements Serializable { protected int streetNum; protected String streetName; protected String city; /** * @link aggregation * @clientCardinality * * @supplierCardinality 0..1 * @label liesIn */ protected StateType state; protected int zip; /** * @link aggregation * @label reachedUnder * @clientCardinality * * @supplierCardinality 0..1 */ protected Phone phoneNumber; public int getStreetNum() { return streetNum; } public void setStreetNum(int streetNum) { this.streetNum=streetNum; } public java.lang.String getStreetName() { return streetName; } public void setStreetName(java.lang.String streetName) { this.streetName=streetName; } public java.lang.String getCity() { return city; } public void setCity(java.lang.String city) { this.city=city; } public StateType getState() { return state; } public void setState(StateType state) { this.state=state; } public int getZip() { return zip; } public void setZip(int zip) { this.zip=zip; } public Phone getPhoneNumber() { return phoneNumber; } public void setPhoneNumber(Phone phoneNumber) { this.phoneNumber=phoneNumber; } public boolean equals(Object obj) { if (this == obj) return true; if (! (obj instanceof Address)) return false; // compare elements Address other = (Address) obj; return streetNum == other.getStreetNum() && ((streetName==null && other.getStreetName()==null) || (streetName!=null && streetName.equals(other.getStreetName()))) && ((city==null && other.getCity()==null) || (city!=null && city.equals(other.getCity()))) && ((state==null && other.getState()==null) || (state!=null && state.equals(other.getState()))) && zip == other.getZip() && ((phoneNumber==null && other.getPhoneNumber()==null) || (phoneNumber!=null && phoneNumber.equals(other.getPhoneNumber()))); } } 1.1 contrib/jboss.net/testsuite/src/main/org/jboss/net/samples/store/BusinessPartner.java Index: BusinessPartner.java =================================================================== /* * JBoss, the OpenSource J2EE webOS * * Distributable under LGPL license. * See terms of license at gnu.org. */ // $Id: BusinessPartner.java,v 1.1 2002/04/02 13:48:41 cgjung Exp $ package org.jboss.net.samples.store; /** * Value-object pattern that is mapped via Axis to * a corresponding remote entity bean. * <br> * <h3>Change History</h3> * <ul> * </ul> * @created 22.03.2002 * @author <a href="mailto:[EMAIL PROTECTED]">Christoph G. Jung</a> * @version $Revision: 1.1 $ */ public interface BusinessPartner { public String getName(); public void setName(String name); public Address getAddress(); public void setAddress(Address address); /** client-side implementation */ public static class Impl implements BusinessPartner { protected String name; protected Address address; public String getName() { return name; } public void setName(String name) { this.name = name; } public Address getAddress() { return address; } public void setAddress(Address address) { this.address = address; } } /** interface to a management service */ public interface Service { public BusinessPartner create(String name) throws StoreException; public void delete(BusinessPartner bp) throws StoreException; public BusinessPartner[] findAll() throws StoreException; public void update(BusinessPartner bp); public BusinessPartner findByName(String name) throws StoreException; } } 1.1 contrib/jboss.net/testsuite/src/main/org/jboss/net/samples/store/Item.java Index: Item.java =================================================================== /* * JBoss, the OpenSource J2EE webOS * * Distributable under LGPL license. * See terms of license at gnu.org. */ // $Id: Item.java,v 1.1 2002/04/02 13:48:41 cgjung Exp $ package org.jboss.net.samples.store; import javax.ejb.CreateException; import javax.ejb.FinderException; /** * Useful value-object pattern that is mapped via Axis to * a corresponding remote entity bean and its management service. * <br> * <h3>Change History</h3> * <ul> * </ul> * @created 22.03.2002 * @author <a href="mailto:[EMAIL PROTECTED]">Christoph G. Jung</a> * @version $Revision: 1.1 $ */ public interface Item { public String getName(); // normally, we would hide that, but then itīs not exposed as a wsdl property // which is quite silly public void setName(String name); /** the client-side implementation class is just a container */ public static class Impl implements Item { protected String name; public String getName() { return name; } public void setName(String name) { this.name = name; } } /** the management service for that item */ public interface Service { public Item create(String name) throws StoreException; public void delete(Item item) throws StoreException; public Item[] findAll() throws StoreException; } } 1.1 contrib/jboss.net/testsuite/src/main/org/jboss/net/samples/store/Line.java Index: Line.java =================================================================== /* * JBoss, the OpenSource J2EE webOS * * Distributable under LGPL license. * See terms of license at gnu.org. */ // $Id: Line.java,v 1.1 2002/04/02 13:48:41 cgjung Exp $ package org.jboss.net.samples.store; /** * A kind of entity-value-object that is mapped via Axis to * a corresponding remote entity bean. * <br> * <h3>Change History</h3> * <ul> * </ul> * @created 22.03.2002 * @author <a href="mailto:[EMAIL PROTECTED]">Christoph G. Jung</a> * @version $Revision: 1.1 $ */ public class Line { protected String id; protected Item item; protected double quantity; protected Unit unit; public String getId() { return id; } public Item getItem() { return item; } public void setItem(Item item) { this.item = item; } public void setQuantity(double quantity) { this.quantity = quantity; } public double getQuantity() { return quantity; } public void setUnit(Unit unit) { this.unit = unit; } public Unit getUnit() { return unit; } } 1.1 contrib/jboss.net/testsuite/src/main/org/jboss/net/samples/store/Order.java Index: Order.java =================================================================== /* * JBoss, the OpenSource J2EE webOS * * Distributable under LGPL license. * See terms of license at gnu.org. */ // $Id: Order.java,v 1.1 2002/04/02 13:48:41 cgjung Exp $ package org.jboss.net.samples.store; import java.util.Date; import java.util.Collection; import java.util.Arrays; /** * A kind of entity-value-object that is mapped via Axis to * a corresponding remote entity bean. * <br> * <h3>Change History</h3> * <ul> * </ul> * @created 22.03.2002 * @author <a href="mailto:[EMAIL PROTECTED]">Christoph G. Jung</a> * @version $Revision: 1.1 $ */ public class Order { protected String id; protected Date confirmationDate; protected Date dueDate; protected BusinessPartner businessPartner; protected Collection lines=new java.util.ArrayList(1); public String getId() { return id; } public Date getConfirmationDate() { return confirmationDate; } public Date getDueDate() { return dueDate; } public void setDueDate() { this.dueDate=dueDate; } public BusinessPartner getBusinessPartner() { return businessPartner; } public Line[] getLines() { return (Line[]) lines.toArray(new Line[lines.size()]); } public void setLines(Line[] lines) { this.lines=Arrays.asList(lines); } public void addLine(Line line) { lines.add(line); } public void removeLine(Line line) { lines.remove(line); } } 1.1 contrib/jboss.net/testsuite/src/main/org/jboss/net/samples/store/Phone.java Index: Phone.java =================================================================== /* * JBoss, the OpenSource J2EE webOS * * Distributable under LGPL license. * See terms of license at gnu.org. */ // $Id: Phone.java,v 1.1 2002/04/02 13:48:41 cgjung Exp $ package org.jboss.net.samples.store; /** * A dependent class. * <br> * <h3>Change History</h3> * <ul> * </ul> * @created 21.03.2002 * @author <a href="mailto:[EMAIL PROTECTED]">Christoph G. Jung</a> * @version $Revision: 1.1 $ */ public class Phone implements java.io.Serializable { private int areaCode; private java.lang.String exchange; private java.lang.String number; public Phone() { } public int getAreaCode() { return areaCode; } public void setAreaCode(int areaCode) { this.areaCode = areaCode; } public java.lang.String getExchange() { return exchange; } public void setExchange(java.lang.String exchange) { this.exchange = exchange; } public java.lang.String getNumber() { return number; } public void setNumber(java.lang.String number) { this.number = number; } public boolean equals(Object obj) { // compare elements Phone other = (Phone) obj; if (this == obj) return true; if (!(obj instanceof Phone)) return false; return areaCode == other.getAreaCode() && ((exchange == null && other.getExchange() == null) || (exchange != null && exchange.equals(other.getExchange()))) && ((number == null && other.getNumber() == null) || (number != null && number.equals(other.getNumber()))); } } 1.1 contrib/jboss.net/testsuite/src/main/org/jboss/net/samples/store/StateType.java Index: StateType.java =================================================================== /* * JBoss, the OpenSource J2EE webOS * * Distributable under LGPL license. * See terms of license at gnu.org. */ // $Id: StateType.java,v 1.1 2002/04/02 13:48:41 cgjung Exp $ package org.jboss.net.samples.store; /** * A dependent class. * <br> * <h3>Change History</h3> * <ul> * </ul> * @created 21.03.2002 * @author <a href="mailto:[EMAIL PROTECTED]">Christoph G. Jung</a> * @version $Revision: 1.1 $ */ public class StateType implements java.io.Serializable { private java.lang.String _value_; private static java.util.HashMap _table_ = new java.util.HashMap(); // Constructor protected StateType(java.lang.String value) { _value_ = value; _table_.put(_value_, this); }; public static final java.lang.String _TX = "TX"; public static final java.lang.String _IN = "IN"; public static final java.lang.String _OH = "OH"; /** @associates*/ public static final StateType TX = new StateType(_TX); /** @associates*/ public static final StateType IN = new StateType(_IN); /** @associates*/ public static final StateType OH = new StateType(_OH); public java.lang.String getValue() { return _value_; } public static StateType fromValue(java.lang.String value) throws java.lang.IllegalStateException { StateType enum = (StateType) _table_.get(value); if (enum == null) throw new java.lang.IllegalStateException(); return enum; } public static StateType fromString(String value) throws java.lang.IllegalStateException { return fromValue(value); } public boolean equals(Object obj) { return (obj == this); } public int hashCode() { return toString().hashCode(); } public String toString() { return _value_; } } 1.1 contrib/jboss.net/testsuite/src/main/org/jboss/net/samples/store/StoreException.java Index: StoreException.java =================================================================== /* * JBoss, the OpenSource J2EE webOS * * Distributable under LGPL license. * See terms of license at gnu.org. */ // $Id: StoreException.java,v 1.1 2002/04/02 13:48:41 cgjung Exp $ package org.jboss.net.samples.store; /** * Exception indicating problems with managing items. * <br> * <h3>Change History</h3> * <ul> * </ul> * @created 22.03.2002 * @author <a href="mailto:[EMAIL PROTECTED]">Christoph G. Jung</a> * @version $Revision: 1.1 $ */ public class StoreException extends Exception { /** * Constructor for ItemException. */ public StoreException() { super(); } /** * Constructor for ItemException. * @param arg0 */ public StoreException(String arg0) { super(arg0); } } 1.1 contrib/jboss.net/testsuite/src/main/org/jboss/net/samples/store/Unit.java Index: Unit.java =================================================================== /* * JBoss, the OpenSource J2EE webOS * * Distributable under LGPL license. * See terms of license at gnu.org. */ // $Id: Unit.java,v 1.1 2002/04/02 13:48:41 cgjung Exp $ package org.jboss.net.samples.store; /** * An aggregated pseudo-entity. * <br> * <h3>Change History</h3> * <ul> * </ul> * @created 21.03.2002 * @author <a href="mailto:[EMAIL PROTECTED]">Christoph G. Jung</a> * @version $Revision: 1.1 $ */ public class Unit implements java.io.Serializable { private java.lang.String _value_; private static java.util.HashMap _table_ = new java.util.HashMap(); // Constructor protected Unit(java.lang.String value) { _value_ = value; _table_.put(_value_,this); }; public static final java.lang.String _KG = "KG"; public static final java.lang.String _TN = "TN"; public static final java.lang.String _STCK = "STCK"; /** @associates */ public static final Unit KG = new Unit(_KG); /** @associates */ public static final Unit TN = new Unit(_TN); /** @associates */ public static final Unit STCK = new Unit(_STCK); public java.lang.String getValue() { return _value_;} public static Unit fromValue(java.lang.String value) throws java.lang.IllegalStateException { Unit enum = (Unit) _table_.get(value); if (enum==null) throw new java.lang.IllegalStateException(); return enum; } public static Unit fromString(String value) throws java.lang.IllegalStateException { return fromValue(value); } public boolean equals(Object obj) {return (obj == this);} public int hashCode() { return toString().hashCode();} public String toString() { return _value_;} } 1.1 contrib/jboss.net/testsuite/src/main/org/jboss/net/samples/store/store.dfPackage Index: store.dfPackage =================================================================== package id16kqkcz90wf51cz90yndn; /** @version 2.0 @physicalPackage @__modelType diagram */ class diagram { }/** @__tags @shapeType ClassDiagram */ class __tags { }/** @__options */ class __options { }/** @__positions */ class __positions { }
_______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development