Initial commit from SVN.
This commit is contained in:
9
Foundation TCV/.classpath
Normal file
9
Foundation TCV/.classpath
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="/Common"/>
|
||||
<classpathentry kind="src" path="/Foundation"/>
|
||||
<classpathentry kind="src" path="/Orb"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
20
Foundation TCV/.project
Normal file
20
Foundation TCV/.project
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Foundation TCV</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
<project>Common</project>
|
||||
<project>Foundation</project>
|
||||
<project>Orb</project>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* 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.controller;
|
||||
|
||||
import com.common.util.*;
|
||||
import com.foundation.view.ViewSystemMetadata;
|
||||
|
||||
public interface IClientSessionController {
|
||||
//Identifiers used to send session data back to the client after registering.//
|
||||
public static final String SESSION_DATA_CLIENT_NUMBER = IThinServerController.SESSION_DATA_CLIENT_NUMBER;
|
||||
public static final String SESSION_DATA_LICENSE = IThinServerController.SESSION_DATA_LICENSE;
|
||||
//public static final String SESSION_DATA_APPLICATION_KEY = IThinServerController.SESSION_DATA_APPLICATION_KEY;
|
||||
public static final String SESSION_DATA_CACHE_ALGORITHM = IThinServerController.SESSION_DATA_CACHE_ALGORITHM;
|
||||
public static final String SESSION_DATA_REQUIRED_APPLICATION_BROWSER_VERSION = IThinServerController.SESSION_DATA_REQUIRED_APPLICATION_BROWSER_VERSION;
|
||||
public static final String SESSION_DATA_REQUIRED_APPLICATION_VERSION = IThinServerController.SESSION_DATA_REQUIRED_APPLICATION_VERSION;
|
||||
public static final String SESSION_DATA_FUTURE_APPLICATION_BROWSER_VERSION = IThinServerController.SESSION_DATA_FUTURE_APPLICATION_BROWSER_VERSION;
|
||||
public static final String SESSION_DATA_FUTURE_APPLICATION_VERSION = IThinServerController.SESSION_DATA_FUTURE_APPLICATION_VERSION;
|
||||
public static final String SESSION_DATA_DOWNLOAD_SERVERS = IThinServerController.SESSION_DATA_DOWNLOAD_SERVERS;
|
||||
public static final String SESSION_DATA_APPLICATION_SERVERS = IThinServerController.SESSION_DATA_APPLICATION_SERVERS;
|
||||
public static final String SESSION_DATA_REDIRECT_ADDRESSES = IThinServerController.SESSION_DATA_REDIRECT_ADDRESSES;
|
||||
public static final String SESSION_DATA_FORWARD_ADDRESS = IThinServerController.SESSION_DATA_FORWARD_ADDRESS;
|
||||
public static final String SESSION_DATA_SERVER_SESSION_CONTROLLER = IThinServerController.SESSION_DATA_SERVER_SESSION_CONTROLLER;
|
||||
public static final String SESSION_DATA_RESOURCE_PACKAGE_DATA = IThinServerController.SESSION_DATA_RESOURCE_PACKAGE_DATA;
|
||||
public static final String SESSION_DATA_CODE_DATA = IThinServerController.SESSION_DATA_CODE_DATA;
|
||||
|
||||
public static final String REGISTRATION_APPLICATION_BROWSER_VERSION = IThinServerController.REGISTRATION_APPLICATION_BROWSER_VERSION;
|
||||
public static final String REGISTRATION_APPLICATION_VERSION = IThinServerController.REGISTRATION_APPLICATION_VERSION;
|
||||
public static final String REGISTRATION_CLIENT_CONTROLLER = IThinServerController.REGISTRATION_CLIENT_CONTROLLER;
|
||||
public static final String REGISTRATION_APPLICATION_NAME = IThinServerController.REGISTRATION_APPLICATION_NAME;
|
||||
|
||||
/**
|
||||
* Creates a view and prepares it to receive messages.
|
||||
* @param viewNumber The new view's number as defined by the server.
|
||||
*/
|
||||
public void createView(long viewNumber);
|
||||
/**
|
||||
* Processes a collection of messages from the client.
|
||||
* @param messageOrderNumber The number indicating the order in which the messages should be processed. This keeps one set of messages from getting processed before an earlier set of messages.
|
||||
* @param viewNumber The number identifying which session view will receive the messages.
|
||||
* @param viewMessages The collection of view messages to be processed.
|
||||
* @param waitForResponse Whether the thread should wait to send a response, or return immediatly after the messages begin processing.
|
||||
* @param twoWayMessageContext Whether the server is sending these messages in direct response to a client initiated 2-way message.
|
||||
* @return The return value of the last message or null if not waiting for a response.
|
||||
*/
|
||||
public Object processMessages(long messageOrderNumber, long viewNumber, IList viewMessages, boolean waitForResponse, boolean twoWayMessageContext);
|
||||
/**
|
||||
* Gets the view system metadata which describes the view system including the displays.
|
||||
* @return The metadata describing the view system.
|
||||
*/
|
||||
public ViewSystemMetadata getViewSystemMetadata();
|
||||
/**
|
||||
* Sets the client's current resource groups.
|
||||
* @param categoryKeys The array of resource categories whose associated groups should be made current. The system will load all resource groups associated with the first through the last key (not replacing already loaded groups). The default category is always assumed such that all resource groups will be represented in the current set.
|
||||
*/
|
||||
public void setCurrentResources(String[] categoryKeys);
|
||||
}//IClientSessionController//
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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.controller;
|
||||
|
||||
import com.common.util.*;
|
||||
|
||||
public interface IServerSessionController {
|
||||
/**
|
||||
* Unregisters the client.
|
||||
* This should normally be called before the client disconnects from the server so that resources can be released in a timely mannar.
|
||||
*/
|
||||
public void closeSession();
|
||||
/**
|
||||
* Requests the server open the initial view for the client.
|
||||
* <p>TODO: Should we automate the login here somehow? We could autologin for reconnects, or we could autologin for some types of applications?</p>
|
||||
*/
|
||||
public void requestInitialView();
|
||||
/**
|
||||
* Requests the resource group data for each given resource package.
|
||||
* @param resourcePackages The resource packages whose group data is either missing or stale on the client. This will be a list of ResourcePackage instances.
|
||||
* @return The resource group data for the packages. This will be in compressed serialized form in the same order (1-1) as the resource packages passed to the method.
|
||||
*/
|
||||
public IList requestResourceGroupData(IList resourcePackages);
|
||||
/**
|
||||
* Requests the resource data for each given resource group category.
|
||||
* @param resourceCategories The resource group category whose data is either missing or stale on the client. This will be a list of ResourceCategory instances.
|
||||
* @return The resource data for the categories. This will be in compressed serialized form in the same order (1-1) as the resource categories passed to the method.
|
||||
*/
|
||||
public IList requestResourceData(IList resourceCategories);
|
||||
/**
|
||||
* Requests the bytes for the given code archive names.
|
||||
* @param codeNames The names of the archives which the client is missing or out of date.
|
||||
* @return The contents of the archives in the same order as the code names. If any archive is not capable of being located it's position in the array will be null.
|
||||
*/
|
||||
public byte[][] requestCodeData(String[] codeNames);
|
||||
/**
|
||||
* Processes a collec tion of messages from the client.
|
||||
* @param messageOrderNumber The number indicating the order in which the messages should be processed. This keeps one set of messages from getting processed before an earlier set of messages.
|
||||
* @param viewNumber The number identifying which session view will receive the messages.
|
||||
* @param viewMessages The collection of view messages to be processed.
|
||||
* @param waitForResponse Whether the thread should wait to send a response, or return immediatly after the messages begin processing.
|
||||
* @return The return value of the last message or null if not waiting for a response.
|
||||
*/
|
||||
public Object processMessages(long messageOrderNumber, long viewNumber, IList viewMessages, boolean waitForResponse);
|
||||
}//IServerSessionController//
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2005,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.controller;
|
||||
|
||||
public interface ISessionViewController {
|
||||
public static final int MESSAGE_OPEN_TEMP_FILE = -1;
|
||||
public static final int MESSAGE_LOAD_FROM_FILE = -2;
|
||||
public static final int MESSAGE_SAVE_TO_FILE = -3;
|
||||
public static final int MESSAGE_LOAD_FROM_FILE_STREAMED = -4;
|
||||
public static final int MESSAGE_SAVE_TO_FILE_STREAMED = -5;
|
||||
public static final int MESSAGE_SAVE_TO_FILES_STREAMED = -6;
|
||||
public static final int MESSAGE_COLLECT_FILES_TO_RENAME = -7;
|
||||
public static final int MESSAGE_RENAME_FILES = -8;
|
||||
|
||||
public static final boolean DEBUG = false;
|
||||
}//ISessionViewController//
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* 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.controller;
|
||||
|
||||
import com.common.util.*;
|
||||
|
||||
public interface IThinServerController {
|
||||
public static final String BOUND_NAME = "ThinServerController";
|
||||
|
||||
//Identifiers used to send session data back to the client after registering.//
|
||||
public static final String SESSION_DATA_CLIENT_NUMBER = "clientNumber";
|
||||
/** The license which is used by the client to validate that the server is authentic (not spoofing the application). */
|
||||
public static final String SESSION_DATA_LICENSE = "license";
|
||||
/** Not currently used. This may never be used. */
|
||||
public static final String SESSION_DATA_CACHE_ALGORITHM = "cacheAlgorithm";
|
||||
/** The version string identifying the version of the application browser to be used for this application. */
|
||||
public static final String SESSION_DATA_REQUIRED_APPLICATION_BROWSER_VERSION = "requiredApplicationBrowserVersion";
|
||||
/** The version string identifying the version of the application to be used. This refers to the application's installer versus the application browser's installer. */
|
||||
public static final String SESSION_DATA_REQUIRED_APPLICATION_VERSION = "requiredApplicationVersion";
|
||||
/** The data will be a list of String instances convertable to Address instances which can be used to download updates for the application. */
|
||||
public static final String SESSION_DATA_DOWNLOAD_SERVERS = "downloadServers";
|
||||
/** The data will be a list of String instances convertable to Address instances which can be used to run the application. */
|
||||
public static final String SESSION_DATA_APPLICATION_SERVERS = "applicationServers";
|
||||
/** Not currently used. */
|
||||
public static final String SESSION_DATA_REDIRECT_ADDRESSES = "redirectAddresses";
|
||||
/** Used to tell the client that it should connect to the given address (as a string) (in the same server farm) to start the application. */
|
||||
public static final String SESSION_DATA_FORWARD_ADDRESS = "forwardAddress";
|
||||
/** Provides the client with a session object reference. */
|
||||
public static final String SESSION_DATA_SERVER_SESSION_CONTROLLER = "serverSessionController";
|
||||
/** The version string identifying the future version of the application browser to be used for this application. */
|
||||
public static final String SESSION_DATA_FUTURE_APPLICATION_BROWSER_VERSION = "";
|
||||
/** The version string identifying the future version of the application to be used. This refers to the application's installer versus the application browser's installer. */
|
||||
public static final String SESSION_DATA_FUTURE_APPLICATION_VERSION = "";
|
||||
/** The compressed and serialized IList of ResourcePackages containing all resource package data from the server. The client must mix this with resource package data on the client. */
|
||||
public static final String SESSION_DATA_RESOURCE_PACKAGE_DATA = "resourcePackageData";
|
||||
/** The String[] containing jar name and jar hash pairs for required code resources. */
|
||||
public static final String SESSION_DATA_CODE_DATA = "codeData";
|
||||
|
||||
//Identifiers used to send to the server when the client is registering.//
|
||||
/** The version of the application browser (string) that is trying to make the connection. */
|
||||
public static final String REGISTRATION_APPLICATION_BROWSER_VERSION = "applicationBrowserVersion";
|
||||
/** The version of the application (string) that is trying to make the connection. */
|
||||
public static final String REGISTRATION_APPLICATION_VERSION = "applicationVersion";
|
||||
/** The proxy to the client's controller that will manage the connection. */
|
||||
public static final String REGISTRATION_CLIENT_CONTROLLER = "clientController";
|
||||
/** The name of the application that the client is trying to connect to. */
|
||||
public static final String REGISTRATION_APPLICATION_NAME = "applicationName";
|
||||
/**
|
||||
* Gets the download size and the number of chunks.
|
||||
* @param version The version to be downloaded. This should currently always be the current version.
|
||||
* @return The total size of the download in bytes.
|
||||
*/
|
||||
public int getClientDownloadSize(String version);
|
||||
/**
|
||||
* Downloads the requested client version to the client. This method may not be supported in the future.
|
||||
* @param version The version to be downloaded. This should currently always be the current version.
|
||||
* @param previouslyDownloadedByteCount The number of bytes already on the client.
|
||||
* @return A series of bytes begining right after the last downloaded byte number.
|
||||
*/
|
||||
public byte[] getClientDownloadChunk(String version, int previouslyDownloadedByteCount);
|
||||
/**
|
||||
* Registers a client with the server.
|
||||
* @param registrationData A map of registration data. The map is used to allow changes to occur without preventing old clients from connecting and being told they require updating. See the REGISTRATION_ identifiers.
|
||||
* @return The map of session data, including: The client's unique id number that it must use when sending messages; signed license; session proxy or alternate server address; and/or client version change information; and the resource packages data. This may be null if the application is not being served.
|
||||
*/
|
||||
public LiteHashMap registerClient(IHashMap registrationData);
|
||||
}//IThinServerController//
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* 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.exception;
|
||||
|
||||
public class ServerNotAvailableException extends Exception {
|
||||
/**
|
||||
* ServerNotAvailableException constructor.
|
||||
*/
|
||||
public ServerNotAvailableException() {
|
||||
super();
|
||||
}//ServerNotAvailableException()//
|
||||
/**
|
||||
* ServerNotAvailableException constructor.
|
||||
* @param message
|
||||
*/
|
||||
public ServerNotAvailableException(String message) {
|
||||
super(message);
|
||||
}//ServerNotAvailableException()//
|
||||
}//ServerNotAvailableException//
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (c) 2005,2007 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.model;
|
||||
|
||||
import com.foundation.application.Application;
|
||||
import com.foundation.application.IApplication;
|
||||
import com.foundation.model.Model;
|
||||
import com.foundation.view.resource.ResourceService;
|
||||
|
||||
public abstract class AbstractModel extends Model {
|
||||
/**
|
||||
* A simple implementation of an application so that these orphaned models can have access to a metadata service.
|
||||
*/
|
||||
private static class SimpleApplication extends Application {
|
||||
private static final SimpleApplication singleton = new SimpleApplication();
|
||||
|
||||
/**
|
||||
* SimpleApplication constructor.
|
||||
*/
|
||||
private SimpleApplication() {
|
||||
startup();
|
||||
}//SimpleApplication()//
|
||||
public static SimpleApplication getSingleton() {
|
||||
return singleton;
|
||||
}//getSingleton()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.application.Application#getDefaultRepositoryIdentifier()
|
||||
*/
|
||||
public Object getDefaultRepositoryIdentifier() {
|
||||
return null;
|
||||
}//getDefaultRepositoryIdentifier()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.application.Application#getMetadataLocation()
|
||||
*/
|
||||
public Object getMetadataLocation() {
|
||||
return null;
|
||||
}//getMetadataLocation()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.application.Application#initializeResources(com.foundation.view.resource.ResourceService)
|
||||
*/
|
||||
protected void initializeResources(ResourceService resourceService) {
|
||||
}//initializeResources()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.application.Application#startup()
|
||||
*/
|
||||
protected void startup() {
|
||||
setupMetadataService();
|
||||
}//startup()//
|
||||
}//SimpleApplication//
|
||||
/**
|
||||
* AbstractModel constructor.
|
||||
*/
|
||||
public AbstractModel() {
|
||||
super();
|
||||
}//AbstractModel()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.common.Entity#getApplication()
|
||||
*/
|
||||
public IApplication getApplication() {
|
||||
return SimpleApplication.getSingleton();
|
||||
}//getApplication()//
|
||||
}//AbstractModel//
|
||||
113
Foundation TCV/src/com/foundation/tcv/model/LinkInfo.java
Normal file
113
Foundation TCV/src/com/foundation/tcv/model/LinkInfo.java
Normal file
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Copyright (c) 2006,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.model;
|
||||
|
||||
import java.io.Externalizable;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInput;
|
||||
import java.io.ObjectOutput;
|
||||
|
||||
/*
|
||||
* Encapsulates a link between one component's functionality and another component's target.
|
||||
*/
|
||||
public class LinkInfo implements Externalizable {
|
||||
private int component;
|
||||
private int target;
|
||||
private Object data;
|
||||
private boolean isBoolean;
|
||||
private boolean invertLogic;
|
||||
private boolean nullValue;
|
||||
/**
|
||||
* LinkInfo constructor.
|
||||
*/
|
||||
public LinkInfo() {
|
||||
super();
|
||||
}//LinkInfo()//
|
||||
/**
|
||||
* LinkInfo constructor.
|
||||
* @param component The targeted component.
|
||||
* @param target The target component's target identifier for the linked link-target.
|
||||
* @param data The optional data passed when the link is invoked.
|
||||
* @param invertLogic Whether to invert the result.
|
||||
* @param nullValue The value used when the input is null, or the inverse used when the value is non-null and non-boolean.
|
||||
*/
|
||||
public LinkInfo(int component, int target, Object data, boolean isBoolean, boolean invertLogic, boolean nullValue) {
|
||||
super();
|
||||
this.component = component;
|
||||
this.target = target;
|
||||
this.data = data;
|
||||
this.isBoolean = isBoolean;
|
||||
this.invertLogic = invertLogic;
|
||||
this.nullValue = nullValue;
|
||||
}//LinkInfo()//
|
||||
/**
|
||||
* Gets the reference to the targeted component.
|
||||
* @return The targeted component.
|
||||
*/
|
||||
public int getComponent() {
|
||||
return component;
|
||||
}//getComponent()//
|
||||
/**
|
||||
* Gets the target identifier as defined by the target component.
|
||||
* @return The target component's target identifier for the linked link-target.
|
||||
*/
|
||||
public int getTarget() {
|
||||
return target;
|
||||
}//getTarget()//
|
||||
/**
|
||||
* Gets the optional static data passed when invoking the link.
|
||||
* This will only be non-null if the link target requires data, the required data type is serializable and immutable, and the linking component does not provide any data.
|
||||
* @return The optional data passed when the link is invoked.
|
||||
*/
|
||||
public Object getData() {
|
||||
return data;
|
||||
}//getData()//
|
||||
/**
|
||||
* Gets whether the link is passing boolean data.
|
||||
* @return Whether the link is transfering a boolean value, in which case the nullValue and invertLogic flags should not be ignored.
|
||||
*/
|
||||
public boolean isBoolean() {
|
||||
return isBoolean;
|
||||
}//isBoolean()//
|
||||
/**
|
||||
* Determines whether binary logic should be inverted when invoking the link.
|
||||
* @return Whether inversion of binary logic should occur.
|
||||
*/
|
||||
public boolean invertLogic() {
|
||||
return invertLogic;
|
||||
}//invertLogic()//
|
||||
/**
|
||||
* Gets the value used when the input is null. The inverse will be used when the value is non-null and non-boolean.
|
||||
* @return The value used for a null input.
|
||||
*/
|
||||
public boolean nullValue() {
|
||||
return nullValue;
|
||||
}//nullValue()//
|
||||
/* (non-Javadoc)
|
||||
* @see java.io.Externalizable#readExternal(java.io.ObjectInput)
|
||||
*/
|
||||
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
|
||||
component = in.readInt();
|
||||
target = in.readInt();
|
||||
data = in.readObject();
|
||||
isBoolean = in.readBoolean();
|
||||
invertLogic = in.readBoolean();
|
||||
nullValue = in.readBoolean();
|
||||
}//readExternal()//
|
||||
/* (non-Javadoc)
|
||||
* @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
|
||||
*/
|
||||
public void writeExternal(ObjectOutput out) throws IOException {
|
||||
out.writeInt(component);
|
||||
out.writeInt(target);
|
||||
out.writeObject(data);
|
||||
out.writeBoolean(isBoolean);
|
||||
out.writeBoolean(invertLogic);
|
||||
out.writeBoolean(nullValue);
|
||||
}//writeExternal()//
|
||||
}//LinkInfo//
|
||||
@@ -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//
|
||||
@@ -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//
|
||||
@@ -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//
|
||||
191
Foundation TCV/src/com/foundation/tcv/view/ViewMessage.java
Normal file
191
Foundation TCV/src/com/foundation/tcv/view/ViewMessage.java
Normal 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//
|
||||
Reference in New Issue
Block a user