001: /*
002: * Created on May 6, 2004
003: *
004: * To change the template for this generated file go to
005: * Window>Preferences>Java>Code Generation>Code and Comments
006: */
007: package org.xdev.base.xssl.reflection;
008:
009: import java.util.HashMap;
010:
011: import org.xdev.base.xssl.XSSLAction;
012: import org.xdev.base.xssl.XSSLActionIterator;
013: import org.xdev.base.xssl.XSSLReturn;
014: import org.xdev.base.xssl.XParameter;
015:
016: /**
017: * @author AYegorov
018: *
019: * Company: xDev Group.org
020: *
021: * URL: <a>http://activexml.dev.java.net</a>
022: *
023: * File name: VirtualBind.java
024: *
025: * <p>Is bound: true | false</p>
026: *
027: * <table>
028: * <tr>
029: * <td>Description:</td>
030: * <td>
031: * <!--Your description here-->
032: * </td>
033: * </tr>
034: * </table>
035: * <table>
036: * <tr>
037: * <td colspan="3">
038: * Properties
039: * </td>
040: * </tr>
041: * <tr>
042: * <td>Name</td>
043: * <td>Value</td>
044: * <td>Description</td>
045: * </tr>
046: * <tr>
047: * <td></td>
048: * <td></td>
049: * <td></td>
050: * </tr>
051: * </table>
052: */
053: public class VirtualBind extends XSSLActionIterator {
054:
055: private HashMap methods = new HashMap();
056: private XSSLAction action = null;
057:
058: /**
059: * @param id
060: */
061: public VirtualBind(String id) {
062: super (id);
063: // XXX Auto-generated constructor stub
064: }
065:
066: /**
067: * @param id
068: * @param properties
069: */
070: public VirtualBind(String id, HashMap properties) {
071: super (id, properties);
072: // XXX Auto-generated constructor stub
073: }
074:
075: /* (non-Javadoc)
076: * @see org.xdev.base.core.object.Configuration#getValue()
077: */
078: public Object getObjectValue() {
079: // XXX Auto-generated method stub
080: return null;
081: }
082:
083: /* (non-Javadoc)
084: * @see org.xdev.base.xssl.XSSLAction#set()
085: */
086: protected void set() throws Exception {
087: this .setExecuteElements(false);
088:
089: VirtualBind bind = (VirtualBind) this .getReference();
090:
091: if (bind != null) {
092: this .action = (XSSLAction) this .methods.get(this
093: .getProperty("virtual-name"));
094: }
095: }
096:
097: protected void invoke() throws Exception {
098: super .invoke();
099:
100: if (this .action != null) {
101: this .action.execute(this );
102: }
103: }
104:
105: /* (non-Javadoc)
106: * @see org.xdev.base.xssl.XSSLActionIterator#invoke(org.xdev.base.xssl.XSSLAction)
107: */
108: protected void invoke(XSSLAction component) throws Exception {
109: if (component.hasProperty("virtual-name")) {
110: this .methods.put(component.getProperty("virtual-name"),
111: component);
112: } else if (this .action != null && component.execute(this )) {
113:
114: XSSLAction param = null;
115:
116: if (component.getBooleanProperty("is-parameter")) {
117: param = new XParameter("", new HashMap());
118:
119: ((XParameter) param)
120: .setParameter(((XSSLReturn) component)
121: .getObjectValue());
122: } else {
123: param = component;
124: }
125:
126: this .action.getPersistance().storeObject(
127: param.getProperty("object-id"), param);
128: }
129: }
130:
131: }
|