Initial commit from SVN.

This commit is contained in:
wcrisman
2014-05-30 10:31:51 -07:00
commit b45e56b890
1968 changed files with 370949 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
/*
* Copyright (c) 2003,2009 Declarative Engineering LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Declarative Engineering LLC
* verson 1 which accompanies this distribution, and is available at
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
*/
package com.foundation.tcv.view;
public interface IAbstractRemoteViewComponent {
public static final int MESSAGE_CREATE_COMPONENT = 0;
public static final int MESSAGE_CLOSE_VIEW = 1;
public static final int MESSAGE_DESTROY_COMPONENT = 2;
public static final int MESSAGE_SUSPEND_LAYOUTS = 3;
public static final int LAST_MESSAGE_NUMBER = 3;
/**
* Processes the view message sent by the server component.
* @param viewMessage The message sent by the remote component in response to some remote action.
* @return The response to the message. This may be null if there is no response.
*/
public Object processMessage(ViewMessage viewMessage);
}//IAbstractViewComponent//

View File

@@ -0,0 +1,14 @@
/*
* Copyright (c) 2004,2009 Declarative Engineering LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Declarative Engineering LLC
* verson 1 which accompanies this distribution, and is available at
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
*/
package com.foundation.tcv.view;
/**
* A simple wrapper interface for the result callback of the orb.
*/
public interface IResultCallback extends com.common.orb.IResultCallback {
}//IResultCallback//

View File

@@ -0,0 +1,66 @@
/*
* Copyright (c) 2004,2009 Declarative Engineering LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Declarative Engineering LLC
* verson 1 which accompanies this distribution, and is available at
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
*/
package com.foundation.tcv.view;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
/*
* A simple wrapper around the result of a two-way call sent by the server to the client.
* This wrapper allows the server to order the processing of the result such that messages sent prior to the result will get processed first.
* This wrapper should <b>ALWAYS</b> be used by the client when sending a response.
*/
public class OrderedResult implements java.io.Externalizable {
private long messageNumber = 0;
private Object result = null;
/**
* OrderedResult constructor.
* <p>Note: This constructor is only public to allow efficient deserialization.</p>
*/
public OrderedResult() {
}//OrderedResult()//
/**
* OrderedResult constructor.
* @param messageNumber The ordered message number which should be the next in the sequence on the client.
* @param result The result of the two-way call.
*/
public OrderedResult(long messageNumber, Object result) {
super();
this.messageNumber = messageNumber;
this.result = result;
}//OrderedResult()//
/**
* Gets the message number used by the server to order the messages.
* @return The order number identifying on the server in which order things should be processed.
*/
public long getMessageNumber() {
return messageNumber;
}//getMessageNumber()//
/**
* Gets the result object for the two-way call initiated by the server.
* @return The result object which may be null.
*/
public Object getResult() {
return result;
}//getResult()//
/* (non-Javadoc)
* @see java.io.Externalizable#readExternal(java.io.ObjectInput)
*/
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
messageNumber = in.readLong();
result = in.readObject();
}//readExternal()//
/* (non-Javadoc)
* @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
*/
public void writeExternal(ObjectOutput out) throws IOException {
out.writeLong(messageNumber);
out.writeObject(result);
}//writeExternal()//
}//OrderedResult//

View File

@@ -0,0 +1,191 @@
/*
* Copyright (c) 2003,2009 Declarative Engineering LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Declarative Engineering LLC
* verson 1 which accompanies this distribution, and is available at
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
*/
package com.foundation.tcv.view;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import com.common.debug.*;
/*
* Encapsulates a message passed between the thin view client and server processes to exchange data and invoke methods.
* Also provides result processing methods to allow mutlithreading of message processing.
*/
public class ViewMessage implements java.io.Externalizable {
/** The number that identifies the control the messages is intended for. */
private int controlNumber = 0;
/** The message number within the context of the control. This allows proper ordering of the messages when being processed. */
private int messageNumber = 0;
/** The message's data value. */
private Object messageData = null;
/** The message's data value. */
private Object messageSecondaryData = null;
/** The message's data integer value. */
private int messageInteger = 0;
/** The message's data integer value. */
private int messageSecondaryInteger = 0;
/** The message's data integer value. */
private boolean hasResult = false;
/** The result of the message. */
private Object result = null;
/** Whether the message expects a result. */
private boolean isTwoWayMessage = false;
/** An extra object reference which will not be serialized. The processing code may use this for any purpose. */
private transient Object extra = null;
/**
* ViewMessage constructor.
*/
public ViewMessage() {
super();
}//ViewMessage()//
/**
* ViewMessage constructor.
* @param controlNumber The control number unique with the view context.
* @param messageNumber The message number or type specific to the control.
* @param messageData The optional data specific to the message type.
* @param messageSecondaryData The optional secondary message data reference.
* @param messageInteger The numeric data associated with the message.
* @param messageSecondaryInteger The secondary numeric data associated with the message.
* @param sendThreadNumber Whether the thread id number should be sent. This should only be true for asynchronous messages such as synchronizing.
*/
public ViewMessage(int controlNumber, int messageNumber, Object messageData, Object messageSecondaryData, int messageInteger, int messageSecondaryInteger, boolean isTwoWayMessage) {
super();
this.controlNumber = controlNumber;
this.messageNumber = messageNumber;
this.messageData = messageData;
this.messageSecondaryData = messageSecondaryData;
this.messageInteger = messageInteger;
this.messageSecondaryInteger = messageSecondaryInteger;
this.isTwoWayMessage = isTwoWayMessage;
}//ViewMessage()//
/**
* Gets the sending and receiving control identifier.
* @return The number of the control that is both sending and receiving the message.
*/
public int getControlNumber() {
return controlNumber;
}//getControlNumber()//
/**
* Gets the message number specific to the control that created the message.
* @return The message number specified by the creating control.
*/
public int getMessageNumber() {
return messageNumber;
}//getMessageNumber()//
/**
* Gets the message data specific to the control that created the message.
* @return The message data specified by the creating control and the message number.
*/
public Object getMessageData() {
return messageData;
}//getMessageData()//
/**
* Gets the secondary message data specific to the control that created the message.
* @return The secondary message data specified by the creating control and the message number.
*/
public Object getMessageSecondaryData() {
return messageSecondaryData;
}//getMessageData()//
/**
* Gets the message integer specific to the control that created the message.
* @return The message integer specified by the creating control and the message number.
*/
public int getMessageInteger() {
return messageInteger;
}//getMessageInteger()//
/**
* Gets the secondary message integer specific to the control that created the message.
* @return The secondary message integer specified by the creating control and the message number.
*/
public int getMessageSecondaryInteger() {
return messageSecondaryInteger;
}//getMessageSecondaryInteger()//
/**
* Gets the message result. This result will be set by the message processor on the client or server.
* @return The result of the message.
*/
public Object getResult() {
return result;
}//getResult()//
/**
* Sets the message result and notifies waiting threads that the result is available and the message has been processed.
* @param result The result of the message.
*/
public void setResult(Object result) {
this.result = result;
this.hasResult = true;
synchronized(this) {
notifyAll();
}//synchronized//
}//setResult()//
/**
* Determines whether the message is two way in that it requires a response.
* @return Whether the message requires a response.
*/
public boolean isTwoWayMessage() {
return isTwoWayMessage;
}//isTwoWayMessage()//
/**
* Gets the extra object reference.
* @return An object reference that will not be serialized and may be used how ever the message processing code wishes.
*/
public Object getExtra() {
return extra;
}//getExtra()//
/**
* Sets the extra object reference.
* @param extra An object reference that will not be serialized and may be used how ever the message processing code wishes.
*/
public void setExtra(Object extra) {
this.extra = extra;
}//setExtra()//
/**
* Waits for the result to be set.
* @param timeout The minimum amount of time in milliseconds to wait. If zero then the thread will wait indefiniatly.
* @return Whether the result has been set and may be retrieved.
*/
public synchronized boolean waitForResult(long timeout) {
try {
while(!hasResult) {
wait(timeout);
}//while//
}//try//
catch(Throwable e) {
Debug.handle(e);
}//catch//
return hasResult;
}//waitForResult()//
/* (non-Javadoc)
* @see java.io.Externalizable#readExternal(java.io.ObjectInput)
*/
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
controlNumber = in.readInt();
messageNumber = in.readInt();
messageData = in.readObject();
messageSecondaryData = in.readObject();
messageInteger = in.readInt();
messageSecondaryInteger = in.readInt();
isTwoWayMessage = in.readBoolean();
hasResult = false;
result = null;
}//readExternal()//
/* (non-Javadoc)
* @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
*/
public void writeExternal(ObjectOutput out) throws IOException {
out.writeInt(controlNumber);
out.writeInt(messageNumber);
out.writeObject(messageData);
out.writeObject(messageSecondaryData);
out.writeInt(messageInteger);
out.writeInt(messageSecondaryInteger);
out.writeBoolean(isTwoWayMessage);
}//writeExternal()//
}//ViewMessage//