What is a Domain Object?

I checked dozens of internet pages but didn't find an answer on that question.

Domain is everything meaningful in the scope of
current task, thus domain object is an abstraction of
the real or imaginable entity from the scope of
current task.Can you please give me an example?
I will now explain a little bit why I am asking. But please don't forget to give me an example.
We use the root object as a domain object. "Article" is a domain object in our company. An Article has a 1:m relationship with a "PackageUnit". The PackageUnit is no domain object. Furthermore the PackageUnit has a 1:m relationship with SalesHistoryWeek (which is no domain object too) and so on.
Only the domain object (Article) can create new instances of the objects which are linked to it (PackageUnit and so on). A PackageUnit cannot create a new instance of SalesHistoryWeek, only Article can do this, the domain object.
Furthermore only the domain object has getter and setter methods for the linked non domain objects. So the domain object "jumps" over many knots to get or set an object.
I think this is a strange design and so I am asking here for the meaning of domain objects. Besides this, the coupling of objects is very large in my example and it doesn't respect the Law of Demeter.
What do you think?

Similar Messages

  • Adding domain objects

    Hello,
    I'm working with an application where we have many, many, many domain objects that could be added to a "header". In my business/service interface I don't like to write 50+ of addX(...), addY(...), addZ(...) etc. methods.
    Every domain object extends a domain object base class. In my business/service interface I've added one single method for adding domain objects to make the interface somewhat smaller:
    public void add(DomainObject[] someDomainObjects);
        ...The elements of the domain object array are of different kind, but all extends the domain object base class. I'd like to implement class and method that have a strategy for determining what kind of domain object the current one is in the given array and invoke the correct add(...) method for that particular domain object.
    The most simple way of doing it is to have a very big if-else using instanceof to determine what kind of domain object it is, but it doesn't feel like a very nice design.
    Example:
    public class MyBusinessObject {
        public void add(DomainObject[] someDomainObjects) {
            // Iterate over all domain objects in the array
            for (DomainObject domainObject : someDomainObjects) {
                // Determine what kind of domain object it is and create the correct DAO
                if (domainObject instanceof X) {
                    DomainObjectXDao xDao = new DomainObjectXDao();
                    // Save the current domain object
                    xDao.save((X) domainObject);
                } else if (domainObject instanceof Y) {
                    DomainObjectYDao yDao = new DomainObjectYDao();
                    // Save the current domain object
                    yDao.save((Y) domainObject);
                } else if (domainObject instanceof Z) {
                    DomainObjectZDao zDao = new DomainObjectZDao();
                    // Save the current domain object
                    zDao.save((Z) domainObject);
                } else if (...) {
    }Is there any design pattern for making this a more nice design?
    If anyone could contribute with their good knowledge I'd be very glad!
    Regards, Andreas Eriksson

    Map the DomainObject types to their respective DAOs and look them up as you loop through them in the add method, e.g.:
    public class MyBusinessObject {
      private Map daos = new HashMap();
        daos.put(X.class, new XDomainTypeDAO());
        daos.put(Y.class, new YDomainTypeDAO());
        daos.put(Z.class, new ZDomainTypeDAO());
      public void add(DomainObject[] objs) {
        for (DomainObject obj : objs) {
          Class type = obj.getClass();
          DAO dao = (DAO) daos.get(type);
          if (dao == null) {
            throw new IllegalArgumentException(
              "No DAO configured for DomainObject type " + type);
          dao.save((DomainObject) obj);
    }You'd have to create a DAO interface (or abstract base class) which defines a save method with the signature public void save(DomainObject obj). Then each DAO would have to implement this method and cast the passed domain object to the expected type.
    To take things further, you could introduce a DAOProvider interface to hide where the MyBusinessObject obtains the DAOs from (rather than have it maintain the map), e.g.:
    public interface DAOProvider {
      DAO daoFor(Class domainType);
    // A really simple implementation - assmes that DAOs are thread-safe
    public class SimpleDAOProvider implements DAOProvider {
      private Map daos = new HashMap();
        daos.put(X.class, new XDomainTypeDAO());
        daos.put(Y.class, new YDomainTypeDAO());
        daos.put(Z.class, new ZDomainTypeDAO());
      public DAO daoFor(Class domainType) {
         DAO dao = (DAO) daos.get(type);
         if (dao == null) {
           throw new IllegalArgumentException(
             "No DAO configured for DomainObject type " + domainType);
        return dao;
    }The advantage of this is you can alter the strategy for handing out DAOs, e.g. pass the same instance back each time, or dynamically instantiate a new instance, etc. Of course, you need a way for the MyBusinessObject to get hold of a DAOProvider instance (inject it? Have it use a factory?)

  • Domain Object and Service oriented pattern

    We have J2EE based application with following components, we are facing some issues with existing system.
    Current System : We have J2EE based application. The following is the flow.
    Client Layer [including JSP, Struts ] action classes  Delegates  Session fa�ade [Session bean]  DAO EJBDAO  EJB. We use CMP, xDoclets , JBOSS.
    1.     Our Domain objects are heavy. I know they are suppose to be coarse objects but they take more time in loading. Also, we noticed one thing that lot of methods are called during Domain Object creation process and it takes lot of time in loading. Actually, we dont really know what is happening as we are using CMPs.
    Question :
    -     Any input on what can be done to avoid Domain object excessive loading time.
    -     Anyone can share there experiences with Domain objects. Are you facing issues related with performance.
    -     We dont use DTO, we pass domain objects between. Do you see any problem in doing that.
    2.     Currently, our system was used by one single front end or lets say we have only one client but soon we will have more clients using it.
    Question :
    -     What should be our design approach. How can we make our system more like service oriented. If the two clients demand different business logic then how it will be handled. Business logic common to all the clients will be handled by which layer and business logic specific to client will be handles by which layer.
    -     Please suggest based on our existing infrastructure. We don�t want to use SOAP or cannot make drastic changes to our flow.
    We have domain and services in the same package and we are doing the refactoring of code, your inputs will be valuable.
    Thanks
    Sandipan

    What type of logger do you use and what is the loger-level during production?
    If it is log4j set the logger to level INFO or WARN.
    This might sound trivia but can make a difference between 20seconds and 500 ms.

  • DAO and Domain Object

    hi,
    Normally when i want to persist a domain object like Customer object to a database, my statements will be below,
    // code from my facade
    Customer cust = new Customer();
    cust.setFirstName("myname");
    cust.setLastName("mylastname");
    // set another attributes
    cust.create();
    with this code i have a CustomerPersistence object to handler for create this customer record to a database. Now j2ee have a DAO pattern. So my question is,
    1.where is a domain object within DAO pattern? --> because of we can reused domain object.
    2.DTO is Domain Object, isn't it?
    3.when i look at some articles about DAO, many of it will present in this way
    facade -->create DTO --> call DAO (plus something about factory pattern)
    i never see something like this
    facade --> domain object --> dao
    any suggestion?
    anurakth
    sorry for my english!!

    Hi,
    I am a bit confused about implementation of the domain model and I wondered if you could help. My main concern is that I am introducing too many layers and data holders into the mix. Here is what I am thinking.
    DTO - used to carry data between the presentation and the services layer
    Service Class - coordinates the calling of domain objects
    Domain Object - models a domain entity, service layer logic specific to this object is to be implemented here.
    Data Object - an exact representation of a database table. many to many relationship between domain object and data object.
    Hibernate DAO Class - has no properties, just methods used for read and writing the object to the database. It is passed in the Data Object for persistence. Is it wrong that the DAO contains no properties?
    Perhaps the domain object will contain each data object it is comprised of. I was originally going to keep calls to DAOs in the Services class (as recommended in http://jroller.com/page/egervari/20050109#how_to_change_services_logic ) but I am thinking that each domain object could expose a save method, and that method would co-ordinate persisting itself to the various tables it is derived from.
    Does this sound resonable? I have trouble finding a pattern on the net that clealy defines the Domain Model. I was tempted to map Domain Objects directly to database tables, and simply persist the Domain Object, but this 1-1 relationship may not always hold true.
    Thanks.

  • Bean vs Domain Object Responsibility

    Any thoughts out there regarding the decision point on when to put functionality into a domain object (Customer, Order, Address, etc.) versus when to put it into an EJB that you plan to use? You usually start defining your object model and as you create sequence diagrams or collab. diagrams, you begin assigning methods to the classes. But at what point do you decide that functionality does NOT belong in the domain object and instead belongs outside of that object? EJBs have the ability to perform a lot of the work in an N-Tier system, so how do you draw the line on where the functionality goes? Any articles on the subject?
    Thnx.
    Dave

    Any thoughts out there regarding the decision point on
    when to put functionality into a domain object
    (Customer, Order, Address, etc.) versus when to put it
    into an EJB that you plan to use? When you need to access system resources, like connecting to the database, you may place the functionality in EJB. When you need to perform task of processing the domain object related information like the net purchase of the customer then you place the functionality in the domain object.
    You usually start
    defining your object model and as you create sequence
    diagrams or collab. diagrams, you begin assigning
    methods to the classes. But at what point do you
    decide that functionality does NOT belong in the
    domain object and instead belongs outside of that
    object? EJBs have the ability to perform a lot of the
    work in an N-Tier system, so how do you draw the line
    on where the functionality goes? Any articles on the
    subject?
    Thnx.
    DaveThats my opinion.
    Best Regards,
    Amitabh Choudhury.

  • How to bind Hibernate domain objects to the UI layer

    Dear All,
    I am trying to bind FX UI controls to properties of a Hibernate Domain object. Is there any good example to refer to for this purpose?
    Thanks & Regards,
    Nitin Gupta

    Assuming you do not formulate your hibernate objects as pojos with javafx properties directly, if the hibernate object is a pojo with or without PCL, you can convert the properties of the pojo to observable values (or properties) directly. These are used in a bind statement.
    Check out what jgoodies does with BeanAdapter or PresentationModel. You need the same concept. I've attached a class that does this for a pojo already (its an incomplete port of jgoodies PresentationModel). It will work for any pojo. It does not have setter support as it was just a demonstration. Its efficient for a pojo with a large number of properties. You could also write a very short property connector to produce one observable value per property. The value of the class below is to be able to swap out the bean being observed without having to change or reset the property observable values each time. Bind once and then just reset the bean (think master detail).
    package scenegraphdemo;
    import java.beans.PropertyChangeEvent;
    import java.beans.PropertyChangeListener;
    import java.lang.reflect.Method;
    import java.util.HashMap;
    import java.util.Map;
    import javafx.beans.property.ObjectProperty;
    import javafx.beans.property.ObjectPropertyBase;
    import javafx.beans.property.Property;
    import javafx.beans.property.StringProperty;
    import javafx.beans.value.ChangeListener;
    import javafx.beans.value.ObservableValue;
    import javafx.beans.value.WritableValue;
    * An object binding object that creates object bindings based on property names
    * specified as strings. This is a convenience class to avoid having observable
    * values directly dependent on the underlying bean. The actual bean the
    * properties connect can be changed dynamically using the channel or
    * <code>setBean</code>. This allows you to setup binding when you don't have
    * the bean to bind to or the bean to bind to will change as in the detail part
    * of a master-detail screen. Generally, the return values from
    * <code>getProperty()</code> should be used for binding not the factory itself.
    * The object should be a domain object bean with bean methods to get or set the
    * value using java bean naming conventions OR it should use javafx property
    * definition conventions. The factory will automatically listen for standard
    * java bean changes using <code>PropertyChangeListener</code> approaches unless
    * you indicate to not to.
    * <p>
    * When the bean itself changes, the properties fire to indicate that their
    * values may have changed and the observing object should update itself. This
    * object allows you to integrate your javafx/POJOs into the binding
    * infrastructure without being dependent on the actual underlying bean. If you
    * are familiar with jgoodies <code>BindingAdapter</code> this is a similar
    * class.
    * <p>
    * This only handles reading bean properties. Need to add set() logic.
    * <p>
    * TODO: Make this work better. Many corner cases to cover.
    * <p>
    * TODO: Instead of just method calls on POJOs, also check for PCL. Note that
    * javafx properties won't work easily they are always tied to the underlying
    * object so I would have to write another CaptiveObjectProperty object that is
    * essentially a delegator.
    public class BeanPropertyFactory<T> extends ObjectProperty<T> {
         ObservableValue<T> channel;
         Map<String, CaptiveObjectProperty> properties = new HashMap<String, CaptiveObjectProperty>();
         boolean listenForBeanPCLEvents = true;
         public boolean isListenForBeanPCLEvents() {
              return listenForBeanPCLEvents;
         public void setListenForBeanPCLEvents(boolean listenForBeanPCLEvents) {
              this.listenForBeanPCLEvents = listenForBeanPCLEvents;
              if (getBean() != null)
                   removeBeanPCLListener(getBean());
          * The bean channel where the bean is obtained.
          * @return
         public ObservableValue<T> getChannel() {
              return channel;
         public BeanPropertyFactory() {
              setChannel(new ObjectProperty());
         public BeanPropertyFactory(ObservableValue<T> channel) {
              if (channel == null)
                   setChannel(new ObjectProperty());
              else
                   setChannel(channel);
         protected void setChannel(ObservableValue<T> channel) {
              if (this.channel != null) {
                   removeBeanChangeListener(this.channel);
              this.channel = channel;
              if (this.channel != null) {
                   addBeanChangeListener(this.channel);
                   updateStringProperty(getBean());
              invalidateProperties();
              fireValueChangedEvent();
         protected StringProperty stringProperty = new StringProperty();
          * The string property is an observable toString property. It cannot be set.
          * @return
         public StringProperty beanStringProperty() {
              return stringProperty;
         public String getBeanString() {
              return beanStringProperty().getValue();
          * A listener that listens to changes in the bean channel. This only fires
          * when the bean changes not when the properties on the bean change. The
          * default actions updates the "string" property representation of this
          * object as well as attaches property change listeners.
          * @author Mr. Java
         protected class BeanChangeListener implements ChangeListener {
              @Override
              public void changed(ObservableValue arg0, Object arg1, Object arg2) {
                   if (arg1 != null) {
                        BeanPropertyFactory.this.removeBeanPCLListener(arg1);
                   if (arg2 != null) {
                        BeanPropertyFactory.this.addBeanPCLListener(arg2);
                   updateStringProperty(arg2);
         protected void updateStringProperty(Object obj) {
              if (obj != null)
                   beanStringProperty().setValue(obj.toString());
              else
                   beanStringProperty().setValue("null");
         protected void removeBeanChangeListener(ObservableValue<T> obj) {
              if (beanChangeListener == null)
                   beanChangeListener = createBeanChangeListener();
              if (obj != null) {
                   obj.addListener(beanChangeListener);
         protected void addBeanChangeListener(ObservableValue<T> obj) {
              if (beanChangeListener == null)
                   beanChangeListener = createBeanChangeListener();
              if (obj != null)
                   obj.removeListener(beanChangeListener);
          * The instance of a change listener for detecting when the bean in the bean
          * channel changes.
         ChangeListener beanChangeListener = new BeanChangeListener();
          * Subclass can override to create their bean change listener.
          * @return
         protected ChangeListener createBeanChangeListener() {
              return new BeanChangeListener();
         public BeanPropertyFactory(T bean) {
              setChannel(new ObjectProperty(bean));
         public Property getProperty(String property) {
              if (property == null || property.isEmpty())
                   throw new IllegalArgumentException("Property cannot be null");
              if (properties.containsKey(property))
                   return properties.get(property);
              CaptiveObjectProperty p = new CaptiveObjectProperty(this, property);
              properties.put(property, p);
              return p;
         @Override
         public T getValue() {
              return getBean();
          * A listener that listens for property change events on the bean. When the
          * bean changes, the listener must be removed then attached to the new bean
          * but can use the same instance of this class. The action is to inform any
          * existing property objects that the property has changed. The detection of
          * property changes is centralized in the factory class for efficiency.
         protected class BeanPropertyListener implements PropertyChangeListener {
              @Override
              public void propertyChange(PropertyChangeEvent evt) {
                   if (properties.containsKey(evt.getPropertyName())) {
                        CaptiveObjectProperty p = properties.get(evt.getPropertyName());
                        p.propertyChanged();
                   updateStringProperty(getBean());
          * The cached listener instance to listen to the bean (in the bean channel)
          * property change events if it supports PCL.
         PropertyChangeListener beanPropertyListener;
          * Subclasses can override to implement their own behavior. Its best to
          * extend from <code>BeanPropertyListiner</code> to include the default
          * behavior.
          * @return
         protected PropertyChangeListener createBeanPropertyListener() {
              return new BeanPropertyListener();
          * Add a listener only if the PCL methods exist. This listens for property
          * changes on the bean's property not changes in the actually bean held by
          * the bean channel.
         protected void addBeanPCLListener(Object obj) {
              if (!isListenForBeanPCLEvents())
                   return;
              if (obj != null) {
                   if (BeanPropertyUtils.hasPCL(obj.getClass())) {
                        if (beanPropertyListener == null)
                             beanPropertyListener = createBeanPropertyListener();
                        BeanPropertyUtils.addPCL(obj, beanPropertyListener, null);
          * Remove a listener only if the PCL methods exist.
          * @see #attachBeanPCLListener
         protected void removeBeanPCLListener(Object obj) {
              if (obj != null) {
                   if (BeanPropertyUtils.hasPCL(obj.getClass())) {
                        if (beanPropertyListener == null)
                             beanPropertyListener = createBeanPropertyListener();
                        BeanPropertyUtils.removePCL(obj, beanPropertyListener, null);
          * Invalidate the properties in the property cache. Then changed the bean in
          * the bean channel. Then fire a value changed event.
          * @param bean
         public void setBean(T bean) {
              invalidateProperties();
              if (getChannel() instanceof WritableValue) {
                   ((WritableValue) getChannel()).setValue(bean);
              } else {
                   throw new IllegalArgumentException(
                             "Could not set bean value into a non-writable bean channel");
              fireValueChangedEvent();
          * Called to indicate that the underlying bean changed.
         protected void invalidateProperties() {
              for (CaptiveObjectProperty p : properties.values()) {
                   p.invalidate();
         public T getBean() {
              return getChannel().getValue();
          * Lazily get the method representing the property prior to getting or
          * setting. Because this is a property, it can also be bound to.
          * @author Mr. Java
          * @param <T>
         protected static class CaptiveObjectProperty<T> extends
                   ObjectPropertyBase<T> {
               * The string name of the property.
              String readPropertyName, writePropertyName;
               * If the property is really a javafx property, it is stored here.
              Property<T> enhancedProperty;
               * Used if the property is not an enhanced property.
              Method readMethod, writeMethod;
               * The factory that holds the bean we obtain values against.
              BeanPropertyFactory factory;
              public CaptiveObjectProperty(BeanPropertyFactory factory,
                        String property) {
                   this.readPropertyName = property;
                   this.factory = factory;
              public CaptiveObjectProperty(BeanPropertyFactory factory,
                        String property, String writePropertyName) {
                   this.readPropertyName = property;
                   this.writePropertyName = writePropertyName;
                   this.factory = factory;
              @Override
              public Object getBean() {
                   if (factory == null || factory.getBean() == null)
                        return null;
                   return factory.getBean();
              @Override
              public void store(T value) {
                   if (writeMethod == null && enhancedProperty == null) {
                        getWriteMethod(value.getClass());
                   if (writeMethod == null && enhancedProperty == null) {
                        return;
                   try {
                        if (enhancedProperty != null) {
                             enhancedProperty.setValue(value);
                             return;
                        if (getBean() == null)
                             return;
                        writeMethod.invoke(getBean(), value);
                        return;
                   } catch (Exception e) {
                        e.printStackTrace();
              @Override
              public T getValue() {
                   if (readMethod == null && enhancedProperty == null) {
                        getReadMethod();
                   if (readMethod == null && enhancedProperty == null)
                        return null;
                   try {
                        if (enhancedProperty != null)
                             return enhancedProperty.getValue();
                        if (factory.getBean() == null)
                             return null;
                        Object rval = readMethod.invoke(getBean());
                        return (T) rval;
                   } catch (Exception e) {
                        e.printStackTrace();
                   return null;
              @Override
              public String getName() {
                   return readPropertyName;
               * Invalidate the method. Perhaps the bean changed to another object and
               * we should find the method on the new object. This is called prior to
               * the <code>getBean()</code> being changed.
              public void invalidate() {
                   readMethod = null;
                   fireValueChangedEvent();
               * This is used to externally signal that the property has changed. It
               * is quite possible that this object does not detect those changes and
               * hence, an external object (in all cases the BeanPropertyFactory) will
               * signal when a change occurs. Property change detection is centralized
               * in the factory for efficiency reasons.
              public void propertyChanged() {
                   fireValueChangedEvent();
              protected Property getJavaFXReadProperty(String propertyName) {
                   if (factory.getBean() == null)
                        return null;
                   String methodName = getName() + "Property";
                   try {
                        Method mtmp = factory.getBean().getClass()
                                  .getMethod(methodName, new Class<?>[0]);
                        enhancedProperty = (Property) mtmp.invoke(factory.getBean(),
                                  new Object[0]);
                        return enhancedProperty;
                   } catch (Exception e) {
                        // e.printStackTrace();
                        // silently fail here
                   return null;
              protected void getWriteMethod(Class<?> argType) {
                   if (factory == null || factory.getBean() == null)
                        return;
                   if (enhancedProperty == null)
                        enhancedProperty = getJavaFXReadProperty(getName());
                   if (enhancedProperty != null)
                        return;
                   writeMethod = getPojoWriteMethod(getName(), argType);
               * Sets the method, either an enhanced property or the POJO method via
               * reflection.
               * @return
              protected void getReadMethod() {
                   if (factory == null || factory.getBean() == null)
                        return;
                   enhancedProperty = getJavaFXReadProperty(getName());
                   if (enhancedProperty != null)
                        return;
                   // Look for standard pojo method.
                   readMethod = getPOJOReadMethod(getName());
               * Return a get method using reflection.
               * @param propertyName
               * @return
              protected Method getPOJOReadMethod(String propertyName) {
                   if (factory.getBean() == null)
                        return null;
                   // Look for standard pojo method.
                   String methodName = getGetMethodName();
                   try {
                        Method mtmp = factory.getBean().getClass()
                                  .getMethod(methodName, new Class<?>[0]);
                        return mtmp;
                   } catch (Exception e) {
                        // silently fail here
                        // e.printStackTrace();
                   return null;
              protected String getGetMethodName() {
                   String methodName = "get"
                             + Character.toUpperCase(getName().charAt(0));
                   if (getName().length() > 1)
                        methodName += getName().substring(1);
                   return methodName;
               * Return a set method using reflection.
               * @param propertyName
               * @param argType
               * @return
              protected Method getPojoWriteMethod(String propertyName,
                        Class<?> argType) {
                   if (factory.getBean() == null)
                        return null;
                   String methodName = getSetMethodName();
                   try {
                        Method mtmp = factory.getBean().getClass()
                                  .getMethod(methodName, argType);
                        return mtmp;
                   } catch (Exception e) {
                        // silently fail here
                        // e.printStackTrace();
                   return null;
              protected String getSetMethodName() {
                   String methodName = "set"
                             + Character.toUpperCase(getName().charAt(0));
                   if (getName().length() > 1)
                        methodName += getName().substring(1);
                   return methodName;
          * Obtain a property using the binding path. The binding path should be
          * simple property names separated by a dot. The bean has to specified
          * because the return value is a property that can be used directly for
          * binding. The first property specified in the binding path should be a
          * property on the bean.
          * <p>
          * The difference between this and <code>Bindings.select()</code> is not
          * much other that it uses the bean factory machinery and the path can be
          * specified as a string. Of course, the bean can be a plain pojo.
          * @param bindingPath
          * @return
         public static Property propertyFromBindingPath(Object bean,
                   String bindingPath) {
              if (bindingPath == null || bindingPath.isEmpty())
                   return null;
              BeanPropertyFactory lastFactory = null;
              Property lastProperty = null;
              String[] parts = bindingPath.split("\\.");
              if (parts.length > 0) {
                   for (int i = 0; i < parts.length; i++) {
                        if (parts.length() <= 0 || parts[i].isEmpty()) {
                             throw new IllegalArgumentException("Binding path part " + i
                                       + " has no length");
                        BeanPropertyFactory newFactory;
                        if (i == 0)
                             newFactory = new BeanPropertyFactory(bean);
                        else
                             newFactory = new BeanPropertyFactory(
                                       (WritableValue) lastProperty);
                        lastProperty = newFactory.getProperty(parts[i].trim());
                        lastFactory = newFactory;
              return lastProperty;
         * Alot like <code>Bindings.select</code> but also handles pojos.
         * @param bean
         * @param path
         * @return
         public static Property propertyFromBindingPath(Object bean, String... path) {
              String tmp = "";
              for (int i = 0; i < path.length; i++) {
                   tmp += path[i];
                   if (i <= path.length - 1)
                        tmp += ".";
              return propertyFromBindingPath(bean, tmp);
    and a supporting classpackage scenegraphdemo;
    import java.beans.PropertyChangeListener;
    * Static methods for manipulating PCL for standard java beans.
    * @author Mr. Java
    public class BeanPropertyUtils {
         protected final static Class<?>[] NO_ARGS = new Class<?>[] { PropertyChangeListener.class };
         protected final static Class<?>[] ARGS = new Class<?>[] { String.class,
                   PropertyChangeListener.class };
         protected final static String pclAddMethodName = "addPropertyChangeListener";
         protected final static String pclRemoveMethodName = "removePropertyChangeListener";
         * Return true if the class has PCL methods. Does not check for remove.
         * <p>
         * addPropertyChangeListener(PropertyChangeListener)
         * <p>
         * addPropertyChangeListener(String, PropertyChangeListener)
         * @param bean
         * @return
         public static boolean hasPCL(Class<?> clazz) {
              try {
                   if (clazz.getMethod(pclAddMethodName, NO_ARGS) != null) {
                        return true;
              } catch (Exception e) {
                   // silently fail
              try {
                   if (clazz.getMethod(pclAddMethodName, ARGS) != null) {
                        return true;
              } catch (Exception e) {
                   // silently fail
              return false;
         * Add a listener.
         * @param bean
         * @param listener
         * @param propertyName
         public static void addPCL(Object bean, PropertyChangeListener listener,
                   String propertyName) {
              try {
                   if (propertyName == null) {
                        bean.getClass().getMethod(pclAddMethodName, NO_ARGS)
                                  .invoke(bean, new Object[] { listener });
                   } else {
                        bean.getClass()
                                  .getMethod(pclAddMethodName, ARGS)
                                  .invoke(bean,
                                            new Object[] { propertyName, listener });
              } catch (Exception e) {
                   e.printStackTrace();
         * Remove a listener.
         * @param bean
         * @param listener
         * @param propertyName
         public static void removePCL(Object bean, PropertyChangeListener listener,
                   String propertyName) {
              try {
                   if (propertyName == null) {
                        bean.getClass().getMethod(pclRemoveMethodName, NO_ARGS)
                                  .invoke(bean, new Object[] { listener });
                   } else {
                        bean.getClass()
                                  .getMethod(pclRemoveMethodName, ARGS)
                                  .invoke(bean,
                                            new Object[] { propertyName, listener });
              } catch (Exception e) {
                   e.printStackTrace();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              

  • Choicebox with Domain-Objects

    Hi,
    I'm struggeling to find out how to deal with ChoiceBox and domain objects whose toString-method is not appropriate for the label. For ListView I'm able to set a cell factory where I was able to customize the domain to string translation but I'm unable to find something similar for ChoiceBox.
    Tom

    Guess what I've done [1] ;-)
    [1]https://github.com/tomsontom/emfdatabinding-tutorial/blob/master/org.eclipse.ufacekit.ui.jfx.databinding/src/org/eclipse/ufacekit/ui/jfx/databinding/controls/ChoiceBoxViewer.java

  • Annotation Agnostic Domain Objects

    Hi,
    I would like to know how we create annotation agnostic domain objects. At present, i have to DPL annotations in my domain object for persisting in BDB. Siince, i will be sharing
    the domain objects with other projects which may or may not use BDB. So I would like to have annotation agnostic domain objects.
    Is there a way to do it in BDB? I know its possible to do it with Base API. But i would like to know whether its possible it in DPL itself.
    In BDB forums, there were some leads to use EntityModel and AnnotationModel which are not clear to use. I would like to have more example on this, if it is possible to do it by EntityModel or AnnotationModel.
    Any help on this is Highly Appreciated.
    Thanks
    William

    Hi William,
    Just to make sure I understand your question. You basically want to have plain domain objects, non-annotated (non DPL annotated) POJOs representing the domain objects, and you want to use them with JE's DPL, without adding the DPL specific annotations to persist the objects (something similar to what you would do with Hibernate's mapping documents). Correct?
    Regards,
    Andrei

  • Using domain object instead of generated ones?

    I'm using NetBeans, and I'm curious if there's a way that we can use our domain objects with the web service calls rather than the empty stubs generated by wsgen?
    wsgen creates the skeletal client classes, as well as an ObjectFactory that returns instances of those classes. I imagine I could modify ObjectFactory to return our domain objects instead, but then we'd be breaking with wsgen.
    Is there a better solution to this?
    Thanx!

    You can associate a Virtual Host to the loopback IP address 127.0.0.1 read about Virtual Hosts here: http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html
    But with the above configuration alone you can access your app via http://somedomainname.com only on your local machine, no one else on the internet will see it.

  • What kind of view object should I create for this data model?

    I have an entity that has several dates. The dates are stored in a table separate from the entity, each entity date has a date type (open, close, interview, etc) associated with it. The DBAs idea (who else of course!) was to have the flexibility to add new types of dates for entities when needed.
    So you have tables like this -
    Table: EntityTable
    Columns: EntityId, EntityName
    Table: DatesTable
    Columns: EntityId, Date, DateTypeCd
    I need to display an editable ADF form where I can update the entity and the entity dates
    The ADF form would contain something like this -------
    Entity Name: []
    Opening Date: []
    Closing Date: []
    Interview Date: []
    What kind of view object would I need to create to achieve this?

    That would be a master-detail relation 1-* between 'entity' and 'entity dates'. If your dba has set up the foreign key association in the db and you use the wizard to create the business objects, jdev pick up the relation and create the correct master detail relation in the vo layer for you.
    By the way naming a table 'entity' is not a good idea when working with ADFbc. We all talk about entities when we relate to a business object (in this case a row of a table or entity object or EO). So it's hard to distinguish the two, your specific table 'entiyt' and the common term entity or EO which can be a row of any table.
    Timo

  • How can we determine exactly what server an RMI object is bound to?

    We have RMI objects that bind to a server in a cluster. How can we determine for
    monitoring purposes what server a RMI object is currently bound to /executing
    on?
    We have tried the most of the Mbeans but can't find one that returns runtime info
    for startup classes or RMI objects.
    We have a new monitoring requirement we are trying to satisfy.

    try get the value of PKEY_OfflineAvailability using shell property system APIs (SHGetPropertyStoreFromParsingName or ShellFolderItem.ExtendedProperty)
    Visual C++ MVP

  • 6.1 What is the Domain Name when using LDAP

    Hi,
    We are currently installing Tidal 6.1, we are going to integrate Oracle Directory Server for LDAP (not AD).
    Qustion is, what is the domain name we have to provide when we install?
    Master and CM both on Linux.
    Thanks!

    Do you know any document which shows LDAP compatibility?
    I havent seen on Intsallation Guide.
    Problem is, when I install, linux servers are on different network (domain) but LDAP contains different domain details. Wondering how Tidal check the domain details when authenticating.
    When we give LDAP domain details, it gives following error.
    WARN:  javax.security.auth.login.LoginException: [LDAP: error code 49 - Invalid Credentials]
    Anyone know how to increase log level to debug?
    Thanks!

  • Help regarding Domain Object.

    Hi,
    I have a question regarding the domain object. I have a form where there some multiple entries for some fields . The domain object is return mapping to the database fields. How should the domain object be changed to handle multiple fields so that multiple inserts can be done.. Can the domain object be coded as an array type. or how the coding needs to be done..I am using JPA
    If some one knows please post it..
    Thanks,

    sahir,
    check the triggering point of your user exit.
    make sure to use a exit/BADI which triggers right after you press 'SAVE'
    thank you.

  • What are cookie domains used for?

    there is a choice, can someone give me some suggestion?
    What are cookie domains used for?
    A/ to be easily recognizable by digital certificates that are also based on domains
    B/ to instruct the browser that the cookie should be send only to the domain it came from
    C/ to provide convenient way for the user to group cookies by their domains
    D/ All of Above
    E/ None of Above

    Not only does that not appear to be a Java question,
    but the OP didn't even take a guess at the answer and
    explain why he thought that that answer was correct.thanks! i support with your viewpoint, solve a problem will be the most important mission, but not consured! i am cognizant of this is a mistake to ask other questions in java forum ,but this question didn't far away j2ee project, though this is a choice, but only get a answer is not my original intention! i hope i can call on anyone join in this discussion!
    thanks...

  • What is user-defined object?

    hi,
    can someone pls explain to me what does user-defined object means???
    my final yr proj is abt that and i really have no idea abt what is user-defined object...
    thank u...
    (duke point awarded of coz)

    my final yr proj is abt that and i really have no
    e no idea abt what is user-defined object...
    thank u...Well u'd better get started here (http://java.sun.com/docs/books/tutorial/getStarted/index.html) then, dont u ?
    ram.

Maybe you are looking for