diff --git a/.gitignore b/.gitignore index 5e4f0b1275..5ab7a2d9fa 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ hs_err_pid* # Maven files target +target-ide # Eclipse files .classpath diff --git a/admin/admin-api/.gitignore b/admin/admin-api/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/admin/admin-api/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/admin/admin-api/src/main/java/org/marketcetera/admin/AdminClient.java b/admin/admin-api/src/main/java/org/marketcetera/admin/AdminClient.java index cd6b5fe41f..dc311c4f0d 100644 --- a/admin/admin-api/src/main/java/org/marketcetera/admin/AdminClient.java +++ b/admin/admin-api/src/main/java/org/marketcetera/admin/AdminClient.java @@ -49,6 +49,7 @@ public interface AdminClient * * @param inNewUser a User value * @param inPassword a String value + * @return a User value */ User createUser(User inNewUser, String inPassword); @@ -128,7 +129,7 @@ Permission updatePermission(String inPermissionName, /** * Read roles. * - * @return a List<Role> value + * @return a List<Role> value */ List readRoles(); /** diff --git a/admin/admin-api/src/main/java/org/marketcetera/admin/HasCurrentUser.java b/admin/admin-api/src/main/java/org/marketcetera/admin/HasCurrentUser.java new file mode 100644 index 0000000000..36a5ae3e6a --- /dev/null +++ b/admin/admin-api/src/main/java/org/marketcetera/admin/HasCurrentUser.java @@ -0,0 +1,15 @@ +package org.marketcetera.admin; + +/* $License$ */ + +/** + * Tagging interface that provides the current user, whatever that means in a given context. + * + * @author Colin DuPlantis + * @version $Id$ + * @since $Release$ + */ +public interface HasCurrentUser + extends HasUser +{ +} diff --git a/admin/admin-api/src/main/java/org/marketcetera/admin/MutableUserAttributeFactory.java b/admin/admin-api/src/main/java/org/marketcetera/admin/MutableUserAttributeFactory.java index 529da7caa1..0c3214b14b 100644 --- a/admin/admin-api/src/main/java/org/marketcetera/admin/MutableUserAttributeFactory.java +++ b/admin/admin-api/src/main/java/org/marketcetera/admin/MutableUserAttributeFactory.java @@ -17,7 +17,7 @@ public interface MutableUserAttributeFactory * * @param inUser a User value * @param inType a UserAttributeType value - * @param inAttribute a String value + * @param inAttribute a String value * @return a UserAttribute value */ MutableUserAttribute create(User inUser, diff --git a/admin/admin-api/src/main/java/org/marketcetera/admin/UserAttributeFactory.java b/admin/admin-api/src/main/java/org/marketcetera/admin/UserAttributeFactory.java index c0c1d269f8..712eea1a41 100644 --- a/admin/admin-api/src/main/java/org/marketcetera/admin/UserAttributeFactory.java +++ b/admin/admin-api/src/main/java/org/marketcetera/admin/UserAttributeFactory.java @@ -16,7 +16,7 @@ public interface UserAttributeFactory * * @param inUser a User value * @param inType a UserAttributeType value - * @param inAttribute a String value + * @param inAttribute a String value * @return a UserAttribute value */ UserAttribute create(User inUser, diff --git a/admin/admin-api/src/main/java/org/marketcetera/admin/service/PasswordService.java b/admin/admin-api/src/main/java/org/marketcetera/admin/service/PasswordService.java index f72e395cbe..5c1dc12e80 100644 --- a/admin/admin-api/src/main/java/org/marketcetera/admin/service/PasswordService.java +++ b/admin/admin-api/src/main/java/org/marketcetera/admin/service/PasswordService.java @@ -21,7 +21,7 @@ public interface PasswordService /** * Get the hash of the given value. * - * @param inValue a char[][] value + * @param inValues a char[][] value * @return a String value */ String getHash(char[]...inValues); diff --git a/admin/admin-core/.gitignore b/admin/admin-core/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/admin/admin-core/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/admin/admin-rest-server/.gitignore b/admin/admin-rest-server/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/admin/admin-rest-server/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/admin/admin-rpc-client/.gitignore b/admin/admin-rpc-client/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/admin/admin-rpc-client/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/admin/admin-rpc-core/.gitignore b/admin/admin-rpc-core/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/admin/admin-rpc-core/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/admin/admin-rpc-core/src/test/java/org/marketcetera/admin/rpc/AdminRpcUtilTest.java b/admin/admin-rpc-core/src/test/java/org/marketcetera/admin/rpc/AdminRpcUtilTest.java index 659dde0728..9f7404e467 100644 --- a/admin/admin-rpc-core/src/test/java/org/marketcetera/admin/rpc/AdminRpcUtilTest.java +++ b/admin/admin-rpc-core/src/test/java/org/marketcetera/admin/rpc/AdminRpcUtilTest.java @@ -106,7 +106,7 @@ public void testGetRpcRole() rpcRole); } /** - * Test {@link AdminRpcUtil#getRole(com.marketcetera.admin.AdminRpc.Role, RoleFactory)}. + * Test getRole. * * @throws Exception if an unexpected error occurs */ @@ -170,7 +170,7 @@ public void testGetRpcPermission() rpcPermission); } /** - * Test {@link AdminRpcUtil#getUserAttribute(com.marketcetera.admin.AdminRpc.UserAttribute)}. + * Test getUserAttribute. * * @throws Exception if an unexpected error occurs */ diff --git a/admin/admin-rpc-server/.gitignore b/admin/admin-rpc-server/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/admin/admin-rpc-server/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/admin/admin-server/.gitignore b/admin/admin-server/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/admin/admin-server/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/admin/admin-server/src/main/java/org/marketcetera/admin/AddUserToRoleAction.java b/admin/admin-server/src/main/java/org/marketcetera/admin/AddUserToRoleAction.java index aa01a7c911..7c7a912647 100644 --- a/admin/admin-server/src/main/java/org/marketcetera/admin/AddUserToRoleAction.java +++ b/admin/admin-server/src/main/java/org/marketcetera/admin/AddUserToRoleAction.java @@ -18,6 +18,9 @@ */ public class AddUserToRoleAction { + /** + * Validate and start the object. + */ @PostConstruct public void start() { @@ -56,7 +59,7 @@ public String getUsername() /** * Sets the username value. * - * @param a String value + * @param inUsername a String value */ public void setUsername(String inUsername) { @@ -74,18 +77,18 @@ public String getRoleName() /** * Sets the roleName value. * - * @param a String value + * @param inRoleName a String value */ public void setRoleName(String inRoleName) { roleName = inRoleName; } /** - * + * username value */ private String username; /** - * + * role name value */ private String roleName; /** diff --git a/admin/admin-server/src/main/java/org/marketcetera/admin/AddUserToSupervisorRoleAction.java b/admin/admin-server/src/main/java/org/marketcetera/admin/AddUserToSupervisorRoleAction.java index df2dc52369..e9cb58fe8c 100644 --- a/admin/admin-server/src/main/java/org/marketcetera/admin/AddUserToSupervisorRoleAction.java +++ b/admin/admin-server/src/main/java/org/marketcetera/admin/AddUserToSupervisorRoleAction.java @@ -18,6 +18,9 @@ */ public class AddUserToSupervisorRoleAction { + /** + * Validate and start the object. + */ @PostConstruct public void start() { @@ -56,7 +59,7 @@ public String getSubjectUsername() /** * Sets the subjectUsername value. * - * @param a String value + * @param inSubjectUsername a String value */ public void setSubjectUsername(String inSubjectUsername) { @@ -74,18 +77,18 @@ public String getSupervisorPermissionName() /** * Sets the supervisorPermissionName value. * - * @param a String value + * @param inSupervisorPermissionName a String value */ public void setSupervisorPermissionName(String inSupervisorPermissionName) { supervisorPermissionName = inSupervisorPermissionName; } /** - * + * subject username value */ private String subjectUsername; /** - * + * supervisor username value */ private String supervisorPermissionName; /** diff --git a/admin/admin-server/src/main/java/org/marketcetera/admin/provisioning/ProvisioningAgent.java b/admin/admin-server/src/main/java/org/marketcetera/admin/provisioning/ProvisioningAgent.java index bcc560f23d..8634076966 100644 --- a/admin/admin-server/src/main/java/org/marketcetera/admin/provisioning/ProvisioningAgent.java +++ b/admin/admin-server/src/main/java/org/marketcetera/admin/provisioning/ProvisioningAgent.java @@ -111,7 +111,7 @@ public long getPollingInterval() /** * Sets the pollingInterval value. * - * @param a long value + * @param inPollingInterval a long value */ public void setPollingInterval(long inPollingInterval) { @@ -129,7 +129,7 @@ public String getProvisioningDirectory() /** * Sets the provisioningDirectory value. * - * @param a String value + * @param inProvisioningDirectory a String value */ public void setProvisioningDirectory(String inProvisioningDirectory) { @@ -147,7 +147,7 @@ public ClusterService getClusterService() /** * Sets the clusterService value. * - * @param a ClusterService value + * @param inClusterService a ClusterService value */ public void setClusterService(ClusterService inClusterService) { diff --git a/admin/admin-server/src/main/java/org/marketcetera/admin/user/PersistentUser.java b/admin/admin-server/src/main/java/org/marketcetera/admin/user/PersistentUser.java index ab3c51799f..29ddab2315 100644 --- a/admin/admin-server/src/main/java/org/marketcetera/admin/user/PersistentUser.java +++ b/admin/admin-server/src/main/java/org/marketcetera/admin/user/PersistentUser.java @@ -194,9 +194,6 @@ public void setPassword(char[] password) * {@link #validatePassword(char[]) validating} the supplied password. * @param originalPassword the original password. This password should * match the currently configured password. - *

- * The new password is not saved to the database. To save - * the new password to the database, invoke {@link #save()} * * @param newPassword the new password, cannot be empty. * diff --git a/cluster/cluster-api/.gitignore b/cluster/cluster-api/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/cluster/cluster-api/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/cluster/cluster-api/src/main/java/org/marketcetera/cluster/service/ClusterService.java b/cluster/cluster-api/src/main/java/org/marketcetera/cluster/service/ClusterService.java index 6905dd6e8f..f1f407f20e 100644 --- a/cluster/cluster-api/src/main/java/org/marketcetera/cluster/service/ClusterService.java +++ b/cluster/cluster-api/src/main/java/org/marketcetera/cluster/service/ClusterService.java @@ -111,7 +111,7 @@ void setAttribute(String inKey, /** * Get the attribute with the given key for the local cluster member. * - * @param inKey a String value + * @param inKey a String value * @return a String value or null */ String getAttribute(String inKey); @@ -125,7 +125,7 @@ void setAttribute(String inKey, /** * Get the attributes for all cluster members. * - * @return a Map<String,Map&l;String,String>> value + * @return a Map<String,Map<String,String>> value */ Map> getAttributes(); /** diff --git a/cluster/cluster-core/.gitignore b/cluster/cluster-core/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/cluster/cluster-core/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/cluster/cluster-core/src/main/java/org/marketcetera/cluster/SimpleClusterWorkUnitSpec.java b/cluster/cluster-core/src/main/java/org/marketcetera/cluster/SimpleClusterWorkUnitSpec.java index 444459a338..789b4f70ce 100644 --- a/cluster/cluster-core/src/main/java/org/marketcetera/cluster/SimpleClusterWorkUnitSpec.java +++ b/cluster/cluster-core/src/main/java/org/marketcetera/cluster/SimpleClusterWorkUnitSpec.java @@ -104,7 +104,7 @@ public String getWorkUnitUid() /** * Sets the workUnitUid value. * - * @param a String value + * @param inWorkUnitUid a String value */ public void setWorkUnitUid(String inWorkUnitUid) { diff --git a/cluster/cluster-core/src/main/java/org/marketcetera/cluster/service/AbstractClusterService.java b/cluster/cluster-core/src/main/java/org/marketcetera/cluster/service/AbstractClusterService.java index 66d98788e8..ee2531b941 100644 --- a/cluster/cluster-core/src/main/java/org/marketcetera/cluster/service/AbstractClusterService.java +++ b/cluster/cluster-core/src/main/java/org/marketcetera/cluster/service/AbstractClusterService.java @@ -649,8 +649,6 @@ protected Set getActiveWorkUnitSpecs(ClusterWorkUnitS } /** * Establishes the set of work unit specs for the cluster. - * - * @throws InterruptedException if the appropriate cluster lock cannot be established */ protected void establishWorkUnitSpecs() { diff --git a/cluster/cluster-rpc-client/.gitignore b/cluster/cluster-rpc-client/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/cluster/cluster-rpc-client/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/cluster/cluster-rpc-core/.gitignore b/cluster/cluster-rpc-core/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/cluster/cluster-rpc-core/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/cluster/cluster-rpc-server/.gitignore b/cluster/cluster-rpc-server/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/cluster/cluster-rpc-server/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/cluster/cluster-simple/.gitignore b/cluster/cluster-simple/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/cluster/cluster-simple/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/core/.gitignore b/core/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/core/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/core/src/main/java/org/marketcetera/algo/BrokerAlgoTagSpec.java b/core/src/main/java/org/marketcetera/algo/BrokerAlgoTagSpec.java index 35f9767f9c..7752bdb883 100644 --- a/core/src/main/java/org/marketcetera/algo/BrokerAlgoTagSpec.java +++ b/core/src/main/java/org/marketcetera/algo/BrokerAlgoTagSpec.java @@ -187,7 +187,7 @@ public String getDefaultValue() /** * Sets the defaultValue value. * - * @param a String value + * @param inDefaultValue a String value */ public void setDefaultValue(String inDefaultValue) { @@ -205,7 +205,7 @@ public boolean isReadOnly() /** * Sets the isReadOnly value. * - * @param a boolean value + * @param inIsReadOnly a boolean value */ public void setIsReadOnly(boolean inIsReadOnly) { @@ -223,7 +223,7 @@ public String getAdvice() /** * Sets the advice value. * - * @param a String value + * @param inAdvice a String value */ public void setAdvice(String inAdvice) { diff --git a/core/src/main/java/org/marketcetera/core/ApplicationContextProvider.java b/core/src/main/java/org/marketcetera/core/ApplicationContextProvider.java index fa6a587884..afa1c480ec 100644 --- a/core/src/main/java/org/marketcetera/core/ApplicationContextProvider.java +++ b/core/src/main/java/org/marketcetera/core/ApplicationContextProvider.java @@ -28,7 +28,7 @@ public ApplicationContext getApplicationContext() /** * Sets the applicationContext value. * - * @param an ApplicationContext value + * @param inApplicationContext an ApplicationContext value */ public void setApplicationContext(ApplicationContext inApplicationContext) { diff --git a/core/src/main/java/org/marketcetera/core/BaseClientContextualParameters.java b/core/src/main/java/org/marketcetera/core/BaseClientContextualParameters.java index b8792b7f43..e70eb8eaec 100644 --- a/core/src/main/java/org/marketcetera/core/BaseClientContextualParameters.java +++ b/core/src/main/java/org/marketcetera/core/BaseClientContextualParameters.java @@ -26,7 +26,7 @@ public ContextClassProvider getContextClassProvider() /** * Sets the contextClassProvider value. * - * @param a ContextClassProvider value + * @param inContextClassProvider a ContextClassProvider value */ public void setContextClassProvider(ContextClassProvider inContextClassProvider) { diff --git a/core/src/main/java/org/marketcetera/core/BatchQueueProcessor.java b/core/src/main/java/org/marketcetera/core/BatchQueueProcessor.java index dffc0fff5a..e7759b9509 100644 --- a/core/src/main/java/org/marketcetera/core/BatchQueueProcessor.java +++ b/core/src/main/java/org/marketcetera/core/BatchQueueProcessor.java @@ -38,7 +38,7 @@ public BatchQueueProcessor(String inThreadDescription) /** * Create a new BatchQueueProcessor instance. * - * @param inThreadDescription a String value + * @param inThreadDescriptor a String value * @param inQueue a BlockingQueue<Clazz> value */ public BatchQueueProcessor(String inThreadDescriptor, diff --git a/core/src/main/java/org/marketcetera/core/CloseableLock.java b/core/src/main/java/org/marketcetera/core/CloseableLock.java index b9b81cf8c5..d461e51a88 100644 --- a/core/src/main/java/org/marketcetera/core/CloseableLock.java +++ b/core/src/main/java/org/marketcetera/core/CloseableLock.java @@ -2,6 +2,7 @@ import java.io.Closeable; import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReadWriteLock; import org.apache.commons.lang.Validate; diff --git a/core/src/main/java/org/marketcetera/core/QueueMultiProcessor.java b/core/src/main/java/org/marketcetera/core/QueueMultiProcessor.java index e277eb77f7..f4cc1dbdaa 100644 --- a/core/src/main/java/org/marketcetera/core/QueueMultiProcessor.java +++ b/core/src/main/java/org/marketcetera/core/QueueMultiProcessor.java @@ -63,7 +63,7 @@ protected void processData(Clazz inData) *

Subclasses may override this value to customize the batch size. * The default value is {@link Integer#MAX_VALUE}. * - * @return an int value + * @return an int value */ protected int getBatchSize() { diff --git a/core/src/main/java/org/marketcetera/core/ThreadPoolMonitor.java b/core/src/main/java/org/marketcetera/core/ThreadPoolMonitor.java index c0116c6ceb..738102d240 100644 --- a/core/src/main/java/org/marketcetera/core/ThreadPoolMonitor.java +++ b/core/src/main/java/org/marketcetera/core/ThreadPoolMonitor.java @@ -107,7 +107,7 @@ public long getMonitorInterval() /** * Sets the monitorInterval value. * - * @param a long value + * @param inMonitorInterval a long value */ public void setMonitorInterval(long inMonitorInterval) { diff --git a/core/src/main/java/org/marketcetera/core/file/DirectoryWatcher.java b/core/src/main/java/org/marketcetera/core/file/DirectoryWatcher.java index 3b8652fc6e..a4a522cfb6 100644 --- a/core/src/main/java/org/marketcetera/core/file/DirectoryWatcher.java +++ b/core/src/main/java/org/marketcetera/core/file/DirectoryWatcher.java @@ -1,25 +1,23 @@ package org.marketcetera.core.file; -import java.io.File; - /* $License$ */ /** * Watches the given directories for files to be added or modified. * - *

Instantiate a DirectoryWatcher implementer and {@link #setDirectoriesToWatch(File...) add} directories - * to watch. {@link DirectoryWatcher#addWatcher(DirectoryWatcherSubscriber) Subscribe} to notifications and {@link #start() start} the + *

Instantiate a DirectoryWatcher implementer and add directories + * to watch. {@link DirectoryWatcher#addWatcher(DirectoryWatcherSubscriber) Subscribe} to notifications and start the * watcher.

* *

The DirectoryWatcher contract directs that watchers will be notified in the order they subscribed for * each file that: *

    - *
  • exists in the directory upon the call to {@link #start start}
  • + *
  • exists in the directory upon the call to start
  • *
  • is added to the directory after start
  • *
* *

Watchers are notified for each file once and only once. Watcher notifications - * are guaranteed to occur no more frequently than the interval {@link #setPollingInterval(long) set}.

+ * are guaranteed to occur no more frequently than the interval set.

* *

Implementers are guaranteed by contract to provide a thread-safe implementation.

* diff --git a/core/src/main/java/org/marketcetera/core/instruments/InstrumentFromMessage.java b/core/src/main/java/org/marketcetera/core/instruments/InstrumentFromMessage.java index f6dcb70771..40b82269d4 100644 --- a/core/src/main/java/org/marketcetera/core/instruments/InstrumentFromMessage.java +++ b/core/src/main/java/org/marketcetera/core/instruments/InstrumentFromMessage.java @@ -13,10 +13,7 @@ * from a FIX message. *

* Typical usage is - *

- * quickfix.Message message =...
- * {@link InstrumentFromMessage}.{@link #SELECTOR}.{@link DynamicInstrumentFunctionSelector#forValue(Object) forValue}(message).{@link #extract(quickfix.Message) extract}(message);
- * 
+ *
Instrument instrument = InstrumentFromMessage.SELECTOR.forValue(quickfix.Message).extract(quickfix.Message);
* * @author anshul@marketcetera.com * @version $Id$ diff --git a/core/src/main/java/org/marketcetera/core/instruments/InstrumentToMessage.java b/core/src/main/java/org/marketcetera/core/instruments/InstrumentToMessage.java index 05ebb567be..26163a953f 100644 --- a/core/src/main/java/org/marketcetera/core/instruments/InstrumentToMessage.java +++ b/core/src/main/java/org/marketcetera/core/instruments/InstrumentToMessage.java @@ -6,7 +6,6 @@ import quickfix.DataDictionary; import quickfix.FieldMap; -import quickfix.Message; import quickfix.field.SecurityType; import quickfix.field.Symbol; @@ -16,16 +15,7 @@ * instrument onto the supplied FIX message. *

* Typical usage is: - *

- * Instrument instrument = ...
- * quickfix.DataDictionary dataDictionary = ...
- * String msgType = ...
- * quickfix.Message message = ...
- * InstrumentToMessage itm = {@link InstrumentToMessage}.{@link #SELECTOR}.{@link StaticInstrumentFunctionSelector#forInstrument(Instrument) forInstrument}(instrument);
- * if(itm.{@link #isSupported(quickfix.DataDictionary, String) isSupported}(dataDictionary,msgType)) {
- *     itm.{@link #set(Instrument, DataDictionary, String, Message) set}(instrument, dataDictionary, msgType, message);
- * }
- * 
+ *
InstrumentToMessage.SELECTOR.forInstrument(instrument).set(instrument,mMessageFactory.getBeginString(),quickfixMessage);
* * @param The type of instrument handled by this function * @@ -45,7 +35,7 @@ public abstract class InstrumentToMessage extends Instrume *

* NOTE: This method is only meant to be used for unit testing. * It's not recommended that this method be used in production. Use - * {@link #set(org.marketcetera.trade.Instrument,quickfix.DataDictionary, String,quickfix.Message)} instead. + * {@link #set(Instrument, String, quickfix.FieldMap)} instead. * * @param inInstrument the instrument * @param inBeginString the begin string value of the FIX message diff --git a/core/src/main/java/org/marketcetera/core/instruments/package-info.java b/core/src/main/java/org/marketcetera/core/instruments/package-info.java index 670dfa9479..2c16efaa08 100644 --- a/core/src/main/java/org/marketcetera/core/instruments/package-info.java +++ b/core/src/main/java/org/marketcetera/core/instruments/package-info.java @@ -34,7 +34,7 @@ * In cases when an instrument instance is not available and instrument * specific functionality needs to be invoked based on an arbitrary data, * a combination of {@link org.marketcetera.core.instruments.DynamicInstrumentFunctionSelector} - * & {@link org.marketcetera.core.instruments.DynamicInstrumentHandler} is + * & {@link org.marketcetera.core.instruments.DynamicInstrumentHandler} is * used. These classes help dynamically select the instrument specific * functionality in absence of the Instrument object. See * {@link org.marketcetera.core.instruments.InstrumentFromMessage} diff --git a/core/src/main/java/org/marketcetera/core/notifications/AbstractNotificationExecutorMethod.java b/core/src/main/java/org/marketcetera/core/notifications/AbstractNotificationExecutorMethod.java index 06b14e90c7..db486f1199 100644 --- a/core/src/main/java/org/marketcetera/core/notifications/AbstractNotificationExecutorMethod.java +++ b/core/src/main/java/org/marketcetera/core/notifications/AbstractNotificationExecutorMethod.java @@ -42,7 +42,7 @@ public INotification.Severity getMaximumThreshold() /** * Sets the maximumThreshold value. * - * @param an INotification.Severity value + * @param inMaximumThreshold an INotification.Severity value */ public void setMaximumThreshold(INotification.Severity inMaximumThreshold) { @@ -60,7 +60,7 @@ public INotification.Severity getMinimumThreshold() /** * Sets the minimum threshold value. * - * @param an INotification.Severity value + * @param inMinimumThreshold an INotification.Severity value */ public void setMinimumThreshold(INotification.Severity inMinimumThreshold) { diff --git a/core/src/main/java/org/marketcetera/core/notifications/EmailNotification.java b/core/src/main/java/org/marketcetera/core/notifications/EmailNotification.java index addae8609e..bfb66163f6 100644 --- a/core/src/main/java/org/marketcetera/core/notifications/EmailNotification.java +++ b/core/src/main/java/org/marketcetera/core/notifications/EmailNotification.java @@ -31,7 +31,7 @@ public interface EmailNotification /** * Get the recipients for this email. * - * @return a Set&t;String> value + * @return a Set<String> value */ Set getRecipients(); /** diff --git a/core/src/main/java/org/marketcetera/core/notifications/EmailNotificationExecutorMethod.java b/core/src/main/java/org/marketcetera/core/notifications/EmailNotificationExecutorMethod.java index c1332579dc..bf58634f2b 100644 --- a/core/src/main/java/org/marketcetera/core/notifications/EmailNotificationExecutorMethod.java +++ b/core/src/main/java/org/marketcetera/core/notifications/EmailNotificationExecutorMethod.java @@ -82,7 +82,7 @@ public Multimap getNotificationRecipients() /** * Sets the notificationRecipients value. * - * @param a Map<INotification.Severity,String> value + * @param inNotificationRecipients a Map<INotification.Severity,String> value */ public void setNotificationRecipients(Map inNotificationRecipients) { diff --git a/core/src/main/java/org/marketcetera/core/notifications/EmailNotificationImpl.java b/core/src/main/java/org/marketcetera/core/notifications/EmailNotificationImpl.java index 1b656c0fff..6b37269e53 100644 --- a/core/src/main/java/org/marketcetera/core/notifications/EmailNotificationImpl.java +++ b/core/src/main/java/org/marketcetera/core/notifications/EmailNotificationImpl.java @@ -71,7 +71,7 @@ public void setConfigurationFileName(String inConfigurationFileName) /** * Sets the recipients value. * - * @param inRecipients a Set value + * @param inRecipients a Set<String> value */ public void setRecipients(Set inRecipients) { diff --git a/core/src/main/java/org/marketcetera/core/notifications/MultiMethodNotificationExecutor.java b/core/src/main/java/org/marketcetera/core/notifications/MultiMethodNotificationExecutor.java index 606effed6b..39811d2239 100644 --- a/core/src/main/java/org/marketcetera/core/notifications/MultiMethodNotificationExecutor.java +++ b/core/src/main/java/org/marketcetera/core/notifications/MultiMethodNotificationExecutor.java @@ -59,7 +59,7 @@ public List getExecutorMethods() /** * Sets the executorMethods value. * - * @param a List<NotificationExecutorMethod> value + * @param inExecutorMethods a List<NotificationExecutorMethod> value */ public void setExecutorMethods(List inExecutorMethods) { diff --git a/core/src/main/java/org/marketcetera/core/notifications/Notification.java b/core/src/main/java/org/marketcetera/core/notifications/Notification.java index f8e56e5713..4eb9c47ce6 100644 --- a/core/src/main/java/org/marketcetera/core/notifications/Notification.java +++ b/core/src/main/java/org/marketcetera/core/notifications/Notification.java @@ -195,7 +195,7 @@ public void setOriginator(String inOriginator) * @param inBody a String value * @param inTimestamp a Date value * @param inSeverity a Severity value - * @param inOriginator a String value + * @param inOriginator a String value */ public Notification(String inSubject, String inBody, diff --git a/core/src/main/java/org/marketcetera/core/notifications/PagerDutyNotification.java b/core/src/main/java/org/marketcetera/core/notifications/PagerDutyNotification.java index 5c19d8bb18..5cabd93f1e 100644 --- a/core/src/main/java/org/marketcetera/core/notifications/PagerDutyNotification.java +++ b/core/src/main/java/org/marketcetera/core/notifications/PagerDutyNotification.java @@ -39,7 +39,7 @@ public interface PagerDutyNotification /** * Indicate if the Pager Duty notification should be sent. * - * @return a boolean value + * @return a boolean value */ boolean shouldPagerDuty(); } diff --git a/core/src/main/java/org/marketcetera/core/notifications/PagerDutyNotificationExecutorMethod.java b/core/src/main/java/org/marketcetera/core/notifications/PagerDutyNotificationExecutorMethod.java index b9e1c2223f..6df9fc7a48 100644 --- a/core/src/main/java/org/marketcetera/core/notifications/PagerDutyNotificationExecutorMethod.java +++ b/core/src/main/java/org/marketcetera/core/notifications/PagerDutyNotificationExecutorMethod.java @@ -35,7 +35,7 @@ public String getPagerDutyUrl() /** * Sets the pagerDutyUrl value. * - * @param a String value + * @param inPagerDutyUrl a String value */ public void setPagerDutyUrl(String inPagerDutyUrl) { @@ -53,7 +53,7 @@ public String getPagerDutyServiceKey() /** * Sets the pagerDutyServiceKey value. * - * @param a String value + * @param inPagerDutyServiceKey a String value */ public void setPagerDutyServiceKey(String inPagerDutyServiceKey) { @@ -71,7 +71,7 @@ public String getPagerDutyEventType() /** * Sets the pagerDutyEventType value. * - * @param a String value + * @param inPagerDutyEventType a String value */ public void setPagerDutyEventType(String inPagerDutyEventType) { @@ -89,7 +89,7 @@ public String getPagerDutyClient() /** * Sets the pagerDutyClient value. * - * @param a String value + * @param inPagerDutyClient a String value */ public void setPagerDutyClient(String inPagerDutyClient) { diff --git a/core/src/main/java/org/marketcetera/core/notifications/PagerDutyNotificationImpl.java b/core/src/main/java/org/marketcetera/core/notifications/PagerDutyNotificationImpl.java index 05a9e9dc18..633cf7ad57 100644 --- a/core/src/main/java/org/marketcetera/core/notifications/PagerDutyNotificationImpl.java +++ b/core/src/main/java/org/marketcetera/core/notifications/PagerDutyNotificationImpl.java @@ -89,7 +89,7 @@ public String getServiceKey() /** * Sets the eventType value. * - * @param an EventType value + * @param inEventType an EventType value */ public void setEventType(PagerDutyEventType inEventType) { @@ -98,7 +98,7 @@ public void setEventType(PagerDutyEventType inEventType) /** * Sets the incidentKey value. * - * @param a String value + * @param inIncidentKey a String value */ public void setIncidentKey(String inIncidentKey) { diff --git a/core/src/main/java/org/marketcetera/core/notifications/SlackNotificationExecutorMethod.java b/core/src/main/java/org/marketcetera/core/notifications/SlackNotificationExecutorMethod.java index e745676374..fdff6ccb74 100644 --- a/core/src/main/java/org/marketcetera/core/notifications/SlackNotificationExecutorMethod.java +++ b/core/src/main/java/org/marketcetera/core/notifications/SlackNotificationExecutorMethod.java @@ -38,7 +38,7 @@ public String getSlackWebHookUrl() /** * Sets the slackWebHookUrl value. * - * @param a String value + * @param inSlackWebHookUrl a String value */ public void setSlackWebHookUrl(String inSlackWebHookUrl) { @@ -56,7 +56,7 @@ public String getSlackWebHookParams() /** * Sets the slackWebHookParams value. * - * @param a String value + * @param inSlackWebHookParams a String value */ public void setSlackWebHookParams(String inSlackWebHookParams) { diff --git a/core/src/main/java/org/marketcetera/core/position/PositionKeyFactory.java b/core/src/main/java/org/marketcetera/core/position/PositionKeyFactory.java index ef1c29e3c6..97a87937e1 100644 --- a/core/src/main/java/org/marketcetera/core/position/PositionKeyFactory.java +++ b/core/src/main/java/org/marketcetera/core/position/PositionKeyFactory.java @@ -41,18 +41,11 @@ public static PositionKey createEquityKey(String symbol, * Creates an currency position key. Note that account and traderId are * converted to null if they only contain whitespace. * - * @param baseCCY - * baseCCY, cannot be null or whitespace - * @param plCCY - * plCCY, cannot be null or whitespace - * @param nearTenor - * nearTenor, cannot be null or whitespace - * @param account - * account - * @param traderId - * trader id - * @throws IllegalArgumentException - * if symbol is null or whitespace + * @param symbol a String value + * @param account a String value + * @param traderId a String value + * @return a PositionKey<Currency> value + * @throws IllegalArgumentException if one of the given parameters are invalid */ public static PositionKey createCurrencyKey(String symbol, @Nullable String account, @Nullable String traderId) { diff --git a/core/src/main/java/org/marketcetera/core/position/PositionMetrics.java b/core/src/main/java/org/marketcetera/core/position/PositionMetrics.java index 94884b7ff8..0f5eacf4c6 100644 --- a/core/src/main/java/org/marketcetera/core/position/PositionMetrics.java +++ b/core/src/main/java/org/marketcetera/core/position/PositionMetrics.java @@ -7,7 +7,7 @@ /* $License$ */ /** - * Interface to computed position-related metrics. Since the position and realize P&L are not + * Interface to computed position-related metrics. Since the position and realize P&L are not * dependent on market data, they should never be null. Other values may be null if the necessary * market data is unavailable. * @@ -35,43 +35,43 @@ public interface PositionMetrics { BigDecimal getPosition(); /** - * Returns the current P&L value of the incoming position. A positive value indicates a profit + * Returns the current P&L value of the incoming position. A positive value indicates a profit * and a negative value indicates a loss. * - * @return the positional P&L, null if unknown + * @return the positional P&L, null if unknown */ BigDecimal getPositionPL(); /** - * Returns the current P&L value of the day's trading activity. A positive value indicates a + * Returns the current P&L value of the day's trading activity. A positive value indicates a * profit and a negative value indicates a loss. * - * @return the trading P&L, null if unknown + * @return the trading P&L, null if unknown */ BigDecimal getTradingPL(); /** - * Returns the P&L value of the positions closed during the current day. A positive value + * Returns the P&L value of the positions closed during the current day. A positive value * indicates a profit and a negative value indicates a loss. * - * @return the realized P&L, null if unknown + * @return the realized P&L, null if unknown */ BigDecimal getRealizedPL(); /** - * Returns the current P&L value of the open positions. A positive value indicates a profit and + * Returns the current P&L value of the open positions. A positive value indicates a profit and * a negative value indicates a loss. * - * @return the unrealized P&L, null if unknown + * @return the unrealized P&L, null if unknown */ BigDecimal getUnrealizedPL(); /** - * Returns the current total P&L value which is the sum of the realized and unrealized P&L (it - * is also the sum of the positional and trading P&L). A positive value indicates a profit and a + * Returns the current total P&L value which is the sum of the realized and unrealized P&L (it + * is also the sum of the positional and trading P&L). A positive value indicates a profit and a * negative value indicates a loss. * - * @return the total P&L, null if unknown + * @return the total P&L, null if unknown */ BigDecimal getTotalPL(); diff --git a/core/src/main/java/org/marketcetera/core/position/impl/MultiplierCalculator.java b/core/src/main/java/org/marketcetera/core/position/impl/MultiplierCalculator.java index 43b85afb64..159d87d176 100644 --- a/core/src/main/java/org/marketcetera/core/position/impl/MultiplierCalculator.java +++ b/core/src/main/java/org/marketcetera/core/position/impl/MultiplierCalculator.java @@ -9,11 +9,11 @@ /* $License$ */ /** - * A calculator that wraps another calculator and multiplies all P&L values by a - * multiplier. - *

- * If the multiplier is unavailable, this class effectively nulls out all PNL - * values. + *

A calculator that wraps another calculator and multiplies all P&L values by a + * multiplier.

+ * + *

If the multiplier is unavailable, this class effectively nulls out all PNL + * values.

* * @author Will Horn * @version $Id$ @@ -33,7 +33,7 @@ public class MultiplierCalculator * @param delegate * the calculator implementation * @param multiplier - * the multiplier to apply to P&L values, null if unavailable + * the multiplier to apply to P&L values, null if unavailable */ public MultiplierCalculator(PositionMetricsCalculator delegate, BigDecimal multiplier) { diff --git a/core/src/main/java/org/marketcetera/core/position/impl/package-info.java b/core/src/main/java/org/marketcetera/core/position/impl/package-info.java index ad872bd86a..2c6deb0e62 100644 --- a/core/src/main/java/org/marketcetera/core/position/impl/package-info.java +++ b/core/src/main/java/org/marketcetera/core/position/impl/package-info.java @@ -7,7 +7,7 @@ * interfaces are used: *
    *
  • {@link PositionMetricsCalculator} - interface for algorithms processing - * trade and market data to compute position and P&L information
  • + * trade and market data to compute position and P&L information *
* * @author will@marketcetera.com diff --git a/core/src/main/java/org/marketcetera/core/position/package-info.java b/core/src/main/java/org/marketcetera/core/position/package-info.java index ef5597a421..d61553f490 100644 --- a/core/src/main/java/org/marketcetera/core/position/package-info.java +++ b/core/src/main/java/org/marketcetera/core/position/package-info.java @@ -1,7 +1,7 @@ /* $License$ */ /** - * This package provides the interface to real-time position and P&L + * This package provides the interface to real-time position and P&L * data. The dynamically updated data is retrieved through * {@link PositionEngine}. *

diff --git a/core/src/main/java/org/marketcetera/event/beans/MarketDataBean.java b/core/src/main/java/org/marketcetera/event/beans/MarketDataBean.java index 4b33a32ad5..2a451eb92a 100644 --- a/core/src/main/java/org/marketcetera/event/beans/MarketDataBean.java +++ b/core/src/main/java/org/marketcetera/event/beans/MarketDataBean.java @@ -124,7 +124,7 @@ public long getReceivedTimestamp() /** * Sets the receivedTimestamp value. * - * @param a long value + * @param inReceivedTimestamp a long value */ public void setReceivedTimestamp(long inReceivedTimestamp) { @@ -142,7 +142,7 @@ public long getProcessedTimestamp() /** * Sets the processedTimestamp value. * - * @param a long value + * @param inProcessedTimestamp a long value */ public void setProcessedTimestamp(long inProcessedTimestamp) { diff --git a/core/src/main/java/org/marketcetera/event/beans/QuoteBean.java b/core/src/main/java/org/marketcetera/event/beans/QuoteBean.java index 0053185b48..7bcfe75518 100644 --- a/core/src/main/java/org/marketcetera/event/beans/QuoteBean.java +++ b/core/src/main/java/org/marketcetera/event/beans/QuoteBean.java @@ -133,7 +133,7 @@ public int getCount() /** * Sets the count value. * - * @param an int value + * @param inCount an int value */ public void setCount(int inCount) { @@ -151,7 +151,7 @@ public int getLevel() /** * Sets the level value. * - * @param an int value + * @param inLevel an int value */ public void setLevel(int inLevel) { diff --git a/core/src/main/java/org/marketcetera/event/impl/AbstractEventBuilderImpl.java b/core/src/main/java/org/marketcetera/event/impl/AbstractEventBuilderImpl.java index 11546888ca..45126477b3 100644 --- a/core/src/main/java/org/marketcetera/event/impl/AbstractEventBuilderImpl.java +++ b/core/src/main/java/org/marketcetera/event/impl/AbstractEventBuilderImpl.java @@ -58,7 +58,7 @@ public AbstractEventBuilderImpl withSource(Object inSource) /** * Sets the request id value to use with the new event. * - * @param inRequest a long value + * @param inRequestId a long value * @return an AbstractEventBuilderImpl value */ public AbstractEventBuilderImpl withRequestId(long inRequestId) diff --git a/core/src/main/java/org/marketcetera/event/impl/AbstractImbalanceEvent.java b/core/src/main/java/org/marketcetera/event/impl/AbstractImbalanceEvent.java index 1b4b09ccae..3ae5f3851c 100644 --- a/core/src/main/java/org/marketcetera/event/impl/AbstractImbalanceEvent.java +++ b/core/src/main/java/org/marketcetera/event/impl/AbstractImbalanceEvent.java @@ -262,7 +262,7 @@ public final boolean equals(Object obj) /** * Create a new AbstractImbalanceEventImpl instance. * - * @param inImbalanceBean a ImbalanceBean value + * @param inImbalance an ImbalanceBean value * @throws IllegalArgumentException if MessageId < 0 * @throws IllegalArgumentException if Timestamp is null * @throws IllegalArgumentException if Instrument is null diff --git a/core/src/main/java/org/marketcetera/event/impl/AbstractMarketstatEventImpl.java b/core/src/main/java/org/marketcetera/event/impl/AbstractMarketstatEventImpl.java index 59bb9684b5..12baf3d441 100644 --- a/core/src/main/java/org/marketcetera/event/impl/AbstractMarketstatEventImpl.java +++ b/core/src/main/java/org/marketcetera/event/impl/AbstractMarketstatEventImpl.java @@ -308,7 +308,7 @@ public final boolean equals(Object obj) /** * Create a new AbstractMarketstatEventImpl instance. * - * @param inMarketstatBean a MarketstatBean value + * @param inMarketstat a MarketstatBean value * @throws IllegalArgumentException if MessageId < 0 * @throws IllegalArgumentException if Timestamp is null * @throws IllegalArgumentException if Instrument is null diff --git a/core/src/main/java/org/marketcetera/event/impl/DepthOfBookEventBuilder.java b/core/src/main/java/org/marketcetera/event/impl/DepthOfBookEventBuilder.java index d8b8146b43..55dc7a7bc7 100644 --- a/core/src/main/java/org/marketcetera/event/impl/DepthOfBookEventBuilder.java +++ b/core/src/main/java/org/marketcetera/event/impl/DepthOfBookEventBuilder.java @@ -145,7 +145,7 @@ protected final Instrument getInstrument() /** * Get the bids value. * - * @return a List value + * @return a List<BidEvent> value */ protected final List getBids() { @@ -154,7 +154,7 @@ protected final List getBids() /** * Get the asks value. * - * @return a List value + * @return a List<AskEvent> value */ protected final List getAsks() { diff --git a/core/src/main/java/org/marketcetera/event/impl/OptionImbalanceEvent.java b/core/src/main/java/org/marketcetera/event/impl/OptionImbalanceEvent.java index 9b0f63cc6a..edf81deae2 100644 --- a/core/src/main/java/org/marketcetera/event/impl/OptionImbalanceEvent.java +++ b/core/src/main/java/org/marketcetera/event/impl/OptionImbalanceEvent.java @@ -96,8 +96,8 @@ public String toString() /** * Create a new OptionImbalanceEvent instance. * - * @param inImbalanceBean a ImbalanceBean value - * @param inOptionBean an OptionBean value + * @param inImbalance a ImbalanceBean value + * @param inOption an OptionBean value * @throws IllegalArgumentException if MessageId < 0 * @throws IllegalArgumentException if Timestamp is null * @throws IllegalArgumentException if Instrument is null diff --git a/core/src/main/java/org/marketcetera/log/ExactThresholdFilter.java b/core/src/main/java/org/marketcetera/log/ExactThresholdFilter.java index 3e453ddb69..b4311914a9 100644 --- a/core/src/main/java/org/marketcetera/log/ExactThresholdFilter.java +++ b/core/src/main/java/org/marketcetera/log/ExactThresholdFilter.java @@ -13,7 +13,7 @@ /* $License$ */ /** - * + * Provides an {@link AbstractFilter} implementat that matches an exact threshold. * * @author Colin DuPlantis * @version $Id$ @@ -64,17 +64,17 @@ public String toString() { } /** - * Create a ThresholdFilter. - * @param loggerLevel The log Level. - * @param match The action to take on a match. - * @param mismatch The action to take on a mismatch. - * @return The created ThresholdFilter. + * Create an ExactThresholdFilter. + * + * @param level a Level value + * @param onMatch a Result value + * @param onMismatch a Result value + * @return an ExactThresholdFilter value */ @PluginFactory public static ExactThresholdFilter createFilter(@PluginAttribute(value = "level", defaultString = "ERROR") Level level, - @PluginAttribute(value = "onMatch", defaultString = "NEUTRAL") Result onMatch, - @PluginAttribute(value = "onMismatch", defaultString = "DENY") Result onMismatch) { + @PluginAttribute(value = "onMatch", defaultString = "NEUTRAL") Result onMatch, + @PluginAttribute(value = "onMismatch", defaultString = "DENY") Result onMismatch) { return new ExactThresholdFilter(level, onMatch, onMismatch); } - private static final long serialVersionUID = 5773154389436464026L; } diff --git a/core/src/main/java/org/marketcetera/marketdata/AbstractMarketDataFeed.java b/core/src/main/java/org/marketcetera/marketdata/AbstractMarketDataFeed.java index d3aa3599dd..a78113350a 100644 --- a/core/src/main/java/org/marketcetera/marketdata/AbstractMarketDataFeed.java +++ b/core/src/main/java/org/marketcetera/marketdata/AbstractMarketDataFeed.java @@ -376,13 +376,12 @@ protected abstract List doMarketDataRequest(D inData) * Connects to the feed and supplies the given credentials. * * @param inCredentials a C value - * @return a boolean value indicating whether the login + * @return a boolean value indicating whether the login * was successful or not */ protected abstract boolean doLogin(C inCredentials); /** * Disconnect from the feed. - * @throws InterruptedException if the thread was interrupted during execution */ protected abstract void doLogout(); /** diff --git a/core/src/main/java/org/marketcetera/marketdata/AbstractMarketDataFeedToken.java b/core/src/main/java/org/marketcetera/marketdata/AbstractMarketDataFeedToken.java index c7570139cd..5669910490 100644 --- a/core/src/main/java/org/marketcetera/marketdata/AbstractMarketDataFeedToken.java +++ b/core/src/main/java/org/marketcetera/marketdata/AbstractMarketDataFeedToken.java @@ -2,8 +2,8 @@ import java.util.concurrent.ExecutionException; -import org.marketcetera.core.publisher.Subscriber; import org.marketcetera.core.publisher.PublisherEngine; +import org.marketcetera.core.publisher.Subscriber; /** * Represents the responses to a market data request. @@ -59,9 +59,6 @@ protected AbstractMarketDataFeedToken(MarketDataFeedTokenSpec inTokenSpec, * Publishes the given data to all subscribers. * * @param inData an Object value - * @throws InterruptedException if synchronous publications are selected and the thread is interrupted - * while notifying a publisher - * @throws ExecutionException */ @Override public final void publish(Object inData) diff --git a/core/src/main/java/org/marketcetera/marketdata/AbstractMarketDataModule.java b/core/src/main/java/org/marketcetera/marketdata/AbstractMarketDataModule.java index 169de4c0cf..158344f416 100644 --- a/core/src/main/java/org/marketcetera/marketdata/AbstractMarketDataModule.java +++ b/core/src/main/java/org/marketcetera/marketdata/AbstractMarketDataModule.java @@ -52,7 +52,8 @@ * may extend this class. *

* Module Features - * + *
+ * * * * diff --git a/core/src/main/java/org/marketcetera/marketdata/MarketDataRequestBean.java b/core/src/main/java/org/marketcetera/marketdata/MarketDataRequestBean.java index 62a5fa0c32..7d19ba63e6 100644 --- a/core/src/main/java/org/marketcetera/marketdata/MarketDataRequestBean.java +++ b/core/src/main/java/org/marketcetera/marketdata/MarketDataRequestBean.java @@ -107,7 +107,7 @@ public void setAssetClass(AssetClass inAssetClass) /** * Get the symbols value. * - * @return a Set value + * @return a Set<String> value */ public Set getSymbols() { @@ -134,7 +134,7 @@ public void setSymbols(Collection inSymbols) /** * Get the underlyingSymbols value. * - * @return a Set value + * @return a Set<String> value */ public Set getUnderlyingSymbols() { @@ -190,7 +190,7 @@ public void setParameters(Map inParameters) /** * Get the parameters value. * - * @return a Map value + * @return a Map<String,String> value */ public Map getParameters() { @@ -201,7 +201,7 @@ public Map getParameters() /** * Get the content value. * - * @return a Set value + * @return a Set<Content> value */ public Set getContent() { diff --git a/core/src/main/java/org/marketcetera/marketdata/UriScheme.java b/core/src/main/java/org/marketcetera/marketdata/UriScheme.java index 49a0cd46b6..f24f90797b 100644 --- a/core/src/main/java/org/marketcetera/marketdata/UriScheme.java +++ b/core/src/main/java/org/marketcetera/marketdata/UriScheme.java @@ -114,7 +114,6 @@ public boolean equals(Object obj) * @param inHostname a String value * @param inPort an int value * @return a String value containing a conforming URI - * @throws URISyntaxException if the given URI is not syntactically valid * @throws IllegalArgumentException if the host or port is not valid */ public String composeUriString(String inHostname, diff --git a/core/src/main/java/org/marketcetera/metrics/IsotopeService.java b/core/src/main/java/org/marketcetera/metrics/IsotopeService.java index 3e7c869e10..56dd3cf252 100644 --- a/core/src/main/java/org/marketcetera/metrics/IsotopeService.java +++ b/core/src/main/java/org/marketcetera/metrics/IsotopeService.java @@ -193,7 +193,7 @@ public int getFixIsotopeTag() /** * Sets the fixIsotopeTag value. * - * @param an int value + * @param inFixIsotopeTag an int value */ public void setFixIsotopeTag(int inFixIsotopeTag) { diff --git a/core/src/main/java/org/marketcetera/metrics/ThreadedMetric.java b/core/src/main/java/org/marketcetera/metrics/ThreadedMetric.java index 0c3e954038..8c870e11d7 100644 --- a/core/src/main/java/org/marketcetera/metrics/ThreadedMetric.java +++ b/core/src/main/java/org/marketcetera/metrics/ThreadedMetric.java @@ -19,13 +19,13 @@ *

* The class captures the metrics on a per thread basis. The captured metrics * include the time taken by the system between certain checkpoints in code and - * the total number of times the system performed certain computation. + * the total number of times the system performed certain computation.

*

* The computed data is dumped into a per-thread csv file in the jvm's * {@link java.io.File#createTempFile(String, String)} temporary} directory * location. - *

- *

Usage

+ *

+ *

Usage

* The code that needs to be instrumented should be modified to invoke * ThreadedMetric as follows. *
@@ -78,7 +78,7 @@
  *   thread local variables to keep track of iterations, you might get
  *   non-intuitive results. 
  * 

- *

Output

+ *

Output

*

* The class will dump the collected metrics as a CSV file, in the temp * directory location with the name @@ -123,11 +123,11 @@ *

* Under certain circumstances, the rows may contain extra columns at the end. * These extra columns either contain any extra data that was supplied to any of - * the checkpoint calls: begin(), event() & end() for the + * the checkpoint calls: begin(), event() & end() for the * iteration that the row represents. OR they may contain extra checkpoint * time deltas resulting from event() invocations within a loop. *

- *

Configuration & Management

+ *

Configuration & Management

*

* The instrumentation is disabled by default. It can be turned on via JMX * or via a properties file placed in the classpath. For more information @@ -158,7 +158,7 @@ public static void begin(Object ... inParams) { * * @param inIdentifier the name of the milestone. The milestone name * should be different from the reserved identifier names, - * {@link #BEGIN_IDENTIFIER} & {@link #END_IDENTIFIER}. + * {@link #BEGIN_IDENTIFIER} & {@link #END_IDENTIFIER}. * @param inParams any extra information to include in the summary. */ public static void event(String inIdentifier, Object... inParams) { diff --git a/core/src/main/java/org/marketcetera/module/ModuleDescriptor.java b/core/src/main/java/org/marketcetera/module/ModuleDescriptor.java index 814346687d..d86049226d 100644 --- a/core/src/main/java/org/marketcetera/module/ModuleDescriptor.java +++ b/core/src/main/java/org/marketcetera/module/ModuleDescriptor.java @@ -18,7 +18,7 @@ public class ModuleDescriptor /** * Get the parameters value. * - * @return a List value + * @return a List<Object> value */ public List getParameters() { @@ -27,7 +27,7 @@ public List getParameters() /** * Sets the parameters value. * - * @param inParameters a List value + * @param inParameters a List<Object> value */ public void setParameters(List inParameters) { diff --git a/core/src/main/java/org/marketcetera/module/ModuleFactory.java b/core/src/main/java/org/marketcetera/module/ModuleFactory.java index 79d6a90161..a3bf2dd6c1 100644 --- a/core/src/main/java/org/marketcetera/module/ModuleFactory.java +++ b/core/src/main/java/org/marketcetera/module/ModuleFactory.java @@ -119,8 +119,7 @@ public final boolean isAutoInstantiate() { /** * Returns the name of the module provider. A module - * provider URI has the following form.
- * metc:provType:providerName + * provider URI has the following form: metc:provType:providerName * * @return the provider's URN */ diff --git a/core/src/main/java/org/marketcetera/module/ModuleManagerMXBean.java b/core/src/main/java/org/marketcetera/module/ModuleManagerMXBean.java index 35a651d18f..18a8e26367 100644 --- a/core/src/main/java/org/marketcetera/module/ModuleManagerMXBean.java +++ b/core/src/main/java/org/marketcetera/module/ModuleManagerMXBean.java @@ -43,23 +43,23 @@ * when invoking the create module instance API. * *
    - *
  • Example 1:
  • - *
      - *
    • Parameter Types:ModuleURN, URL, String, BigDecimal
    • - *
    • Parameter Value: - * "metc:surface:color:red,http://red.com,username,12.43" - *
    • - *
    - *
  • Example 2:
  • - *
      - *
    • Parameter Types:File, boolean, double, BigInteger
    • - *
    • Parameter Value:"c:\\mydir,true,345.643,83723849"
    • - *
    + *
  • Example 1: + *
      + *
    • Parameter Types:ModuleURN, URL, String, BigDecimal
    • + *
    • Parameter Value:"metc:surface:color:red,http://red.com,username,12.43"
    • + *
    + *
  • + *
  • Example 2: + *
      + *
    • Parameter Types:File, boolean, double, BigInteger
    • + *
    • Parameter Value:"c:\\mydir,true,345.643,83723849"
    • + *
    + *
  • *
* - *

Create Data Flows

+ *

Create Data Flows

* This parameter syntax applies to the first parameter of APIs - * {@link #createDataFlow(String)} & + * {@link #createDataFlow(String)} & * {@link #createDataFlow(String, boolean)}. *

* The API accepts a series of data requests. Each data request consists of @@ -80,34 +80,34 @@ * Here are some examples of strings that can be used when setting up data * flows. *

    - *
  • Example 1.
  • - *
      - *
    • "metc:mdata;symbol=ibm^metc:strategy::vegas^metc:sink"
    • - *
    • Sets up a data flow between any market data module that generates + *
    • Example 1. + *
        + *
      • "metc:mdata;symbol=ibm^metc:strategy::vegas^metc:sink"
      • + *
      • Sets up a data flow between any market data module that generates * market data for symbol 'ibm', pipes that data to a strategy named * 'vegas' and pipes its output to the sink module.
      • - *
      - *
    • Example 2.
    • - *
        - *
      • "metc:mdata:opentick;symbol=java^metc:strategy::charity^metc:server"
      • - *
      • Sets up a data flow between opentick market data module, that - * generates market data for symbol 'java', pipes that data to a - * strategy called 'charity' and pipes the trades generated by it to - * the system client module that sends it to the server.
      • - *
      - *
    • Example 3.
    • - *
        - *
      • "metc:mdata;symbol=aapl,goog^metc:cep:esper;select * from Bid^metc:strategy::buy;12^^32^^43"
      • - *
      • Sets up a data flow between any market data module that generates - * data for symbols, aapl & goog, pipes that data into the esper module, that - * runs the cep query 'select * from Bid' and pipes its output to - * a strategy module 'buy' that accepts a string parameter '12^32^43'. - *
      • - *
      + *
    + * + *
  • Example 2. + *
      + *
    • "metc:mdata:opentick;symbol=java^metc:strategy::charity^metc:server"
    • + *
    • Sets up a data flow between opentick market data module, that + * generates market data for symbol 'java', pipes that data to a + * strategy called 'charity' and pipes the trades generated by it to + * the system client module that sends it to the server.
    • + *
    + *
  • + *
  • Example 3. + *
      + *
    • "metc:mdata;symbol=aapl,goog^metc:cep:esper;select * from Bid^metc:strategy::buy;12^^32^^43"
    • + *
    • Sets up a data flow between any market data module that generates + * data for symbols, aapl & goog, pipes that data into the esper module, that + * runs the cep query 'select * from Bid' and pipes its output to + * a strategy module 'buy' that accepts a string parameter '12^32^43'.
    • + *
    + *
  • *
* - * - * * @author anshul@marketcetera.com * @version $Id$ * @since 1.0.0 diff --git a/core/src/main/java/org/marketcetera/module/ModuleState.java b/core/src/main/java/org/marketcetera/module/ModuleState.java index 8c186802a5..1cc9dc31cf 100644 --- a/core/src/main/java/org/marketcetera/module/ModuleState.java +++ b/core/src/main/java/org/marketcetera/module/ModuleState.java @@ -24,11 +24,11 @@ * | start() * | * v - * ,------> {@link #STARTING} + * ,------> {@link #STARTING} * / |\ ^ * | | \ \ start() * | | v \ delete() - * | | {@link #START_FAILED}--------->. + * | | {@link #START_FAILED}--------->. * | | | * | v | * | {@link #STARTED} | @@ -41,13 +41,13 @@ * | |\ ^ | * | | \ \ stop() | * | | v \ delete() | - * | | {@link #STOP_FAILED}---------->| + * | | {@link #STOP_FAILED}---------->| * | | | * \ v | * '------- {@link #STOPPED} | * | | * | delete() | - * |<--------------------------------' + * |<--------------------------------' * v * O * @@ -57,8 +57,9 @@ * various module framework operations can be invoked on a module. If * a module operation is invoked while it's not in one of the states for * that operation in the table below, the operation will fail. - *

- *

Indicates the module features
CapabilitiesData Emitter
Stops data flowsNo
Start OperationStarts the feed, logs into it.
+ *

+ *
+ * * * * diff --git a/core/src/main/java/org/marketcetera/module/ModuleURN.java b/core/src/main/java/org/marketcetera/module/ModuleURN.java index 6adc22d710..04e020a469 100644 --- a/core/src/main/java/org/marketcetera/module/ModuleURN.java +++ b/core/src/main/java/org/marketcetera/module/ModuleURN.java @@ -19,9 +19,9 @@ * of the URN evaluate as equal. *

* The URNs have the following format - *
+ * * metc:provType:provider:instance - *
+ * * where: *

    *
  • metc: The URN prefix metc indicating a marketcetera URN
  • diff --git a/core/src/main/java/org/marketcetera/module/PropertiesConfigurationProvider.java b/core/src/main/java/org/marketcetera/module/PropertiesConfigurationProvider.java index 4ade5177c0..1cc0917783 100644 --- a/core/src/main/java/org/marketcetera/module/PropertiesConfigurationProvider.java +++ b/core/src/main/java/org/marketcetera/module/PropertiesConfigurationProvider.java @@ -25,7 +25,7 @@ * Within the property file, the attribute values are encoded as * instance-name.attribute-name=attribute-value. * Default attribute values, that apply to all instances can be specified as - * .attribute-name=attribute-value.attribute-name=attribute-value. *

    * For factory attributes, "instance-name." is excluded from * the property name, ie. the attribute value is specified as diff --git a/core/src/main/java/org/marketcetera/module/SinkModule.java b/core/src/main/java/org/marketcetera/module/SinkModule.java index 8988935180..c347263c7c 100644 --- a/core/src/main/java/org/marketcetera/module/SinkModule.java +++ b/core/src/main/java/org/marketcetera/module/SinkModule.java @@ -38,6 +38,7 @@ *

    * Module Features *

Module State Capabilities
Module OperationModule State
delete{@link #CREATED}, {@link #START_FAILED}, {@link #STOPPED}
stop{@link #STARTED}, {@link #STOP_FAILED}
+ * * * * diff --git a/core/src/main/java/org/marketcetera/module/SinkModuleFactory.java b/core/src/main/java/org/marketcetera/module/SinkModuleFactory.java index f516de49c5..e01755456f 100644 --- a/core/src/main/java/org/marketcetera/module/SinkModuleFactory.java +++ b/core/src/main/java/org/marketcetera/module/SinkModuleFactory.java @@ -8,6 +8,7 @@ *

* The factory has the following characteristics. *

Sink Module Capabilities
CapabilitiesDataReceiver
Stops data flowsNo
Start OperationDoes nothing
+ * * * * diff --git a/core/src/main/java/org/marketcetera/module/package-info.java b/core/src/main/java/org/marketcetera/module/package-info.java index 9010e08700..f1a47d22c3 100644 --- a/core/src/main/java/org/marketcetera/module/package-info.java +++ b/core/src/main/java/org/marketcetera/module/package-info.java @@ -28,7 +28,7 @@ * linked above. *

*

- * {@link org.marketcetera.module.ModuleURN URNs} are used to uniquely identify module types & module + * {@link org.marketcetera.module.ModuleURN URNs} are used to uniquely identify module types & module * instances. *

*

@@ -152,11 +152,11 @@ *

* Data of any type can be used for all these three usages. However, modules are * strongly recommended to accept strings, in addition to any specific types they need, - * for usages 1 & 2 above. + * for usages 1 & 2 above. *

*

* Module Framework API is available via an MXBean through JMX. And - * that API only supports string parameters for usages 1 & 2 above. The module + * that API only supports string parameters for usages 1 & 2 above. The module * framework automatically converts string parameters to actual java types, * for a limited set of types listed below, for usage 1 above. * To the extent modules support string @@ -278,7 +278,7 @@ * A module can acquire the capability to initiate a data flow by implementing * {@link org.marketcetera.module.DataFlowRequester}. It can then create and * cancel data flows via {@link org.marketcetera.module.DataFlowSupport}. - * A module can request & cancel data flows when it's in the + * A module can request & cancel data flows when it's in the * {@link org.marketcetera.module.ModuleState#isStarted() started} state. * It's expected that a module will typically create data flows when it's started * from within its {@link org.marketcetera.module.Module#preStart()} method. @@ -312,7 +312,7 @@ *

* Do note that if the module or the module factory implements * {@link javax.management.DynamicMBean} make sure that the types used - * for various bean attributes & operations are limited to standard java + * for various bean attributes & operations are limited to standard java * types. Otherwise, tools like jconsole will not be able to display * information from those beans. *

@@ -325,7 +325,7 @@ *

* The module framework functions are exported via * {@link org.marketcetera.module.ModuleManagerMXBean}. All of its operations - * accept parameters of primitive & string types, so that they can be easily + * accept parameters of primitive & string types, so that they can be easily * invoked by widely available jmx clients like jconsole. Operations to * create module instances and data flows support special string syntax as * these operations accept complex parameters. Look at the bean's class @@ -417,6 +417,7 @@ * sub-classes for examples. *

*
Sink Module Factory Capabilities
Provider URN:metc:sink:system
Cardinality:Singleton
InstanceURN:metc:sink:system:single
+ * * * @@ -442,6 +443,7 @@ * sub-classes for examples. *

*
Describes the ModuleFactory
Provider URN:The provider URN
Cardinality:If the factory creates a singleton module * instance or if it can create module instances.
+ * * *
Describes the Module
CapabilitiesIf the module can emit, receive data and if it * can request data flows.
DataFlow Request ParametersThe type of parameters that diff --git a/core/src/main/java/org/marketcetera/persist/CollectionPageResponse.java b/core/src/main/java/org/marketcetera/persist/CollectionPageResponse.java index a7f2b8d68f..a2a829153a 100644 --- a/core/src/main/java/org/marketcetera/persist/CollectionPageResponse.java +++ b/core/src/main/java/org/marketcetera/persist/CollectionPageResponse.java @@ -26,7 +26,7 @@ public CollectionPageResponse() {} /** * Create a new CollectionPageResponse instance. * - * @param inPage a Page<Clazz>: value + * @param inPage a Page<Clazz> value */ public CollectionPageResponse(Page inPage) { diff --git a/core/src/main/java/org/marketcetera/persist/NDEntityBase.java b/core/src/main/java/org/marketcetera/persist/NDEntityBase.java index 430cc07558..67ff18b5b1 100644 --- a/core/src/main/java/org/marketcetera/persist/NDEntityBase.java +++ b/core/src/main/java/org/marketcetera/persist/NDEntityBase.java @@ -22,20 +22,6 @@ *

* Supporting query classes are also provided to easily add * query support for the subclasses. - * - *

- * {@link org.marketcetera.persist.SingleNDEntityQuery} provides - * support for queries that fetch single instance given the entity - * name. Note that this assumes the names of the entities are unique - * amongst all its instances. To ensure that, subclasses that make - * use of this feature should declare a unique constraint on the - * name attribute. - *

- * {@link org.marketcetera.persist.MultiNDQuery} provides support - * for queries that fetch multiple instances of subclasses of this - * class. The query class provides filters to filter the query - * results by name and description filters. It also provides - * orders to order the results by name or description. * */ @MappedSuperclass diff --git a/core/src/main/java/org/marketcetera/persist/TransactionModuleFactory.java b/core/src/main/java/org/marketcetera/persist/TransactionModuleFactory.java index 720e8467f6..8cd6edac13 100644 --- a/core/src/main/java/org/marketcetera/persist/TransactionModuleFactory.java +++ b/core/src/main/java/org/marketcetera/persist/TransactionModuleFactory.java @@ -12,6 +12,7 @@ *

* The factory has the following characteristics. * + * * * * diff --git a/core/src/main/java/org/marketcetera/persist/package.html b/core/src/main/java/org/marketcetera/persist/package.html deleted file mode 100644 index ae73148e64..0000000000 --- a/core/src/main/java/org/marketcetera/persist/package.html +++ /dev/null @@ -1,387 +0,0 @@ - -

- This package provides basic building blocks for creating objects that can be stored - within an rdbms. Base classes are provided to represent entities and to query them. - Facilities are also provided to transparently save and query entities across a remoting - API, like JMX or JMS. -

-

- The persistence infrastructure has two layers. -

    -
  1. The Services layer abstracts all persistence operations into a small set of internal - methods that can easily be remoted if needed. This layer also provides transaction - boundaries and JPA entity manager instances for the entities layer above it. The - interfaces provided by this layer are only meant to be used by the Entities layer.
  2. -
  3. The Entities layer runs on top of services layer and provides abstractions that - are meant to be subclassed by anyone wanting to author persistent entities and - provide simple services to save, update, delete and query them. Clients of persistence - infrastructure should use the API provided by the Entities layer.
  4. -
- The Entities Layer is meant to be used by the clients of this system, whereas - the Services layer is a part of the implementation. -

-

Services Layer

-

All persistence operations are abstracted into method calls on the - {@link org.marketcetera.persist.EntityRemoteServices} - interface. Only one concrete implementation of this interface, - {@link org.marketcetera.persist.EntityRemoteServer} is provided. It implements these - methods by invoking the local JPA EntityManagerFactory instance. -

-

- The intent is that, in the future, other implementations of the - {@link org.marketcetera.persist.EntityRemoteServices} can be supplied that can - transparently remote (via JMS, JMX, RMI or any other remoting infrastructure) - persistence operations across JVMs from a client-side VM to the server-side VM that - has an EntityRemoteServer instance configured to carry out all the persistence - operations on a local database. -

-

- This layer is configured via spring. The spring configuration is responsible - for configuring a database connection pool, an entity manager factory and injecting - that factory into the EntityRemoteServer instance. -

-

- Another piece of the infrastructure that is configured via spring is - {@link org.marketcetera.persist.JPAVendor} implementation. - {@link org.marketcetera.persist.JPAVendor} abstracts out our dependency on - vendor specific code. JPA doesn't seem to cover all our usage scenarios, - like blob/clob initialization. This class is used to provide a vendor neutral - mechanism to carry out persistence operations that are not covered via JPA. - This functionality is exposed to the clients of persistence layer via the - {@link org.marketcetera.persist.VendorUtils} class. -

- -

Entities Layer

-

- The entities layer provides base classes for Entities and single / multi instance - queries to fetch them. -

- -

Entities

-

- Any new persistent entity can either extend - {@link org.marketcetera.persist.EntityBase} or - {@link org.marketcetera.persist.NDEntityBase}, - if it has name and description. Make sure to add appropriate JPA annotations to mark it - as a persistent entity. Do annotate any of its non-persitent attributes with a Transient - annotation. -

-

Views

-

- Entities can have attributes that are lazy loaded. These attributes are the ones - that are costly to fetch. Examples include, attributes that represent the entity's - relationship with other entities etc. - To facilitate choice between loading these attributes or not, summary view interfaces - like {@link org.marketcetera.persist.SummaryEntityBase} and - {@link org.marketcetera.persist.SummaryNDEntityBase} are provided. These interfaces - do not contain any setters for the attributes. Its expected, that the sub entites - will create sub-interfaces that extend from these summary interfaces and add all - other non-lazy loaded attributes to it. -

- -

Queries

-

- Two types of queries are supported. -

-
    -
  • Queries that fetch single instances: {@link org.marketcetera.persist.SingleEntityQuery}
  • -
  • Queries that fetch multiple entity instances:{@link org.marketcetera.persist.MultipleEntityQuery}
  • -
-

- Queries provide the option to either load the summary view of the entity or - its full view. Loading the full view is more expensive -

- -

SingleEntityQuery

-

- These queries fetch a single instance of the entity. Examples include fetching - the entity by ID or by its name, etc. -

- -

MultipleEntityQuery

-

- These queries fetch multiple instances of the entity. These queries support - filtering, ordering and paging of the results. For Entities that extend - {@link org.marketcetera.persist.NDEntityBase}, - a base class {@link org.marketcetera.persist.MultiNDQuery} is provided for others - to extend. The subclass implements the filtering & ordering behavior for - entity name and description. -

-

- MultiQueries have filter properties on them to filter their results. By default - these filters are not set. A client of these queries can set these filters to - apply them to the results. See {@link org.marketcetera.persist.MultiNDQuery#getNameFilter()} - for example. -

-

- MultiQueries can have an ordering applied to their results. See - {@link org.marketcetera.persist.MultipleEntityQuery#getEntityOrder()}. -

-

- MultiQueries can specify the - {@link org.marketcetera.persist.MultipleEntityQuery#getFirstResult() starting} - position of the results and the - {@link org.marketcetera.persist.MultipleEntityQuery#getMaxResult() maximum} number of results - to return back. -

-

Development Notes

-

- Once the entities, that need to be persisted, and the relationships between them have - been figured out, we can start authoring classes for them using the persistence - infrastructure. Base classes are available for basic entity operations and unit testing. - See org.marketcetera.persist.example package in the unit test sources for a - sample implementation -

-

Entities

-

- Each entity can either extend {@link org.marketcetera.persist.EntityBase} or - {@link org.marketcetera.persist.NDEntityBase} based on whether - the entity has name and description attributes. If the entity has relationships or lazy loaded - attributes, its recommended that a Summary View be defined for the entity that doesn't - include any relationship or lazy-loaded attributes. The summary view can extend either of - {@link org.marketcetera.persist.SummaryEntityBase} or - {@link org.marketcetera.persist.SummaryNDEntityBase} depending on whether the entity - has name and description attributes. -

-

- Each entity subclass adds appropriate attributes to the class definition. The attributes can - be annotated with JPA annotations if the default behavior is not sufficient. -

-

- Each entity subclass can expose operations to save and delete the entity that in turn invoke - the protected operations provided in the super classes. The entity can also define their own - operations that use these operations. See User class in unit tests for examples - of such operations. -

-

- Relationships between the entities have a side that owns the relationship. Make sure that - the operations to modify the relationship are only exposed on the entity that owns the - relationship. For example, Group owns the relationship between User - and Group -

-

Queries

-

- Each entity has a single instance query and a multi instance query. Base classes are provided - for both kinds of queries. See the org.marketcetera.persist.example package for how - to extend and use these queries. -

-

- Typically, single instance queries will be fairly simple. For multi instance queries you may - want to declare additional filters, orders and operations. -

-

Validation

-

- Entities should be validated prior to save to ensure that all the attributes - have valid values. See {@link org.marketcetera.persist.NDEntityBase#validate()} - for an example on how to do it. Be sure to add both - {@link javax.persistence.PrePersist} and {@link javax.persistence.PreUpdate} to - ensure that validation happens during insert as well as update -

-

- The current database can only save a subset of characters supported by java. - Hence all the strings that are being persisted should be validated to ensure that - they comply with the character set supported by the database. - {@link org.marketcetera.persist.VendorUtils#validateText(CharSequence)} should be invoked - to validate all the string query parameters, & entity attributes. - - Do ensure that all string attributes of the entity being saved are validated - prior to save. Currently, only the name attribute of - {@link org.marketcetera.persist.NDEntityBase} is validated. Any other string attributes - in the entity (including description) should be validated to only contain supported - characters. -

-

- All the string parameters to the query are validated to only supported characters - during query execution with {@link org.marketcetera.persist.QueryBase}. - Hence no special validation is required during query execution. However, if you - author queries that do not make use QueryBase, make sure that all - string parameters to the query are validated. -

-

Unit Testing

-

- Since the extent of compile-time checking is limited. Base classes are available to extensively - test the entities and their queries. The design pattern is to extend a suitable base class for - testing an entity. It can be either of EntityTestBase or NDEntityTestBase - depending on whether the entity has name and description attributes. -

-

- You'd need to implement all the abstract methods to be able to compile the unit tests. You'd want - to over-ride certain methods for any additional attributes that have been added to the entity. - See UserTest for example. -

-

- A base class, ManyToManyTestBase is also provided to test many to many relationships - between entities. See UserGroupTest for an example -

-

- The unit test base classes only provide unit tests to exercise the functionality provided - by the infrastructure. You'd want to add unit tests to exercise any features that have been - built on top of the features provided by the infrastructure. - See UserTest for an example. -

-

Configuration

-

- The global persistence layer is configured via spring configuration. The entities have - to provide a persistence.xml, in the META-INF sub-directory of the jar they - are contained in, to enable their persistence. -

-

Spring Configuration

-

- Here's a sample spring configuration snippet: -

    -
  1. The first bean configures a connection pool data source
  2. -
  3. The second one configures a JPA entity manager factory, supplying it the connection - pool data source.
  4. -
  5. The last bean configures the EntityRemoteServer supplying it the entity manager - factory. Notice that it depends on a jpaVendor bean. The only - {@link org.marketcetera.persist.JPAVendor} implementation currently available - is {@link org.marketcetera.persist.HibernateVendor}.
  6. -
-

-
-{@code
-...
-    
-        
-        
-        
-        
-        
-        
-        
-    
-    
-        
-    
-    
-        
-    
-...
-}
-
-

- Do note that the dependency on the mysql jdbc connector, apache dbcp connection pooling & - spring entity manager bean configuration is only within the spring configuration. The java - code has no dependency on these specific implementations. -

-

- Several properties can be configured for the MySQL jdbc connector and the apache - dbcp connection pool. Configuration details can be found at the following locations. -

- -

persistence.xml Configuration

-

- The persistence.xml schema can be found here. - Good notes on configuring persistence.xml can be found in hibernate documentation - here - The persistence.xml file should be present in the META-INF subdirectory of jar that contains - the classes for the entities being persisted. -

-

- Here's an example persistence.xml file, used to persist entities using hibernate's JPA implementation. -

-
-{@code
-
-   
-      org.hibernate.ejb.HibernatePersistence
-      
-         
-         
-      
-   
-
-}
-
-

- Do note that several hibernate configuration properties can be supplied. Details on the kinds of - properties that can be specified can be found - here. - Do note that an jdbc connection / data source properties should not be specified here as they - are specified via spring configuration. -

-

Design Details

-

- This section has details on design and implementation of the persistence - infrastructure. -

-

Code Paths

-

- This section has sample code paths for certain key interesting code paths in the persistence system. -

-

Save Operation

-

- This section documents the sequence of API invocations that happen when saving an entity. - The sequence is a similar to what happens when the delete operation is invoked. -

-

- The methods with the suffix Remote are meant to be invoked by the client - facing API to invoke a persistence operation. These method invocations endup invoking - the corresponding operation with Local suffix on the entity within the - JVM that has access to the database and is configured with appropriate JPA - EntityManager to interact with the database. -

-
-    {@link org.marketcetera.persist.EntityBase#saveRemote(PersistContext)}
-       |
-       |-{@link org.marketcetera.persist.EntityBase#createSaveResult()}
-       |
-       |-{@link org.marketcetera.persist.EntityRemoteServices#save(EntityBase,PersistContext)}
-       |    |   (Remoting)
-       |    |
-       |    '-{@link org.marketcetera.persist.EntityRemoteServices#execute(Transaction,PersistContext)}
-       |         |   (Transaction Envelope)
-       |         |
-       |         '-{@link org.marketcetera.persist.EntityBase#saveLocal(EntityManager,PersistContext)}
-       |              |
-       |              |-{@link org.marketcetera.persist.EntityBase#postSaveLocal(EntityManager,EntityBase,PersistContext)}
-       |              |         (Can be over-ridden to carry out custom stuff)
-       |              |
-       |              '-{@link org.marketcetera.persist.EntityBase#createSaveResult()}
-       |
-       '-{@link org.marketcetera.persist.EntityBase#applyRemote(SaveResult)}
-
-

Multi Query Execution

-

- This section documents the sequence of API invocations that happen when running a multi - instance query. -

-
-
-    {@link org.marketcetera.persist.MultipleEntityQuery#fetchRemote(MultiQueryProcessor)}
-       |
-       '-{@link org.marketcetera.persist.QueryBase#executeRemote(QueryProcessor)}
-            |
-            '-{@link org.marketcetera.persist.QueryBase#executeRemoteMultiple(List)}
-                 |
-                 '-{@link org.marketcetera.persist.EntityRemoteServices#execute(QueryBase,List)}
-                      |   (Remoting)
-                      |
-                      '-{@link org.marketcetera.persist.EntityRemoteServices#execute(Transaction,PersistContext)}
-                           |   (Transaction Envelope)
-                           |
-                           '-{@link org.marketcetera.persist.QueryBase#executeLocal(EntityManager,List)}
-                                |
-                                |-{@link org.marketcetera.persist.QueryBase#createQuery(EntityManager,QueryProcessor)}
-                                |    |   (creates query string customized by query processor)
-                                |    |
-                                |    |-{@link org.marketcetera.persist.QueryProcessor#preGenerate(StringBuilder,QueryBase)}
-                                |    |
-                                |    |-{@link org.marketcetera.persist.QueryProcessor#needsFetchJoins()}
-                                |    |
-                                |    |-{@link org.marketcetera.persist.QueryProcessor#needsOrderBy()}
-                                |    |
-                                |    |-{@link org.marketcetera.persist.QueryProcessor#postGenerate(StringBuilder)}
-                                |    |
-                                |    '-{@link org.marketcetera.persist.MultipleEntityQuery#preSetParameters(Query)}
-                                |
-                                '-{@link org.marketcetera.persist.QueryProcessor#process(EntityManager,Query)}
-                                      (processes the query to generate results)
-
- \ No newline at end of file diff --git a/core/src/main/java/org/marketcetera/pool/impl/ExecutorServiceProviderImpl.java b/core/src/main/java/org/marketcetera/pool/impl/ExecutorServiceProviderImpl.java index 95aa2c1838..b9fe48f867 100644 --- a/core/src/main/java/org/marketcetera/pool/impl/ExecutorServiceProviderImpl.java +++ b/core/src/main/java/org/marketcetera/pool/impl/ExecutorServiceProviderImpl.java @@ -68,7 +68,7 @@ public int getMaxPoolSize() /** * Sets the maxPoolSize value. * - * @param an int value + * @param inMaxPoolSize an int value */ public void setMaxPoolSize(int inMaxPoolSize) { @@ -86,7 +86,7 @@ public boolean getAllowCoreThreadTimeOut() /** * Sets the allowCoreThreadTimeOut value. * - * @param a boolean value + * @param inAllowCoreThreadTimeOut a boolean value */ public void setAllowCoreThreadTimeOut(boolean inAllowCoreThreadTimeOut) { @@ -104,7 +104,7 @@ public int getCorePoolSize() /** * Sets the corePoolSize value. * - * @param an int value + * @param inCorePoolSize an int value */ public void setCorePoolSize(int inCorePoolSize) { @@ -122,7 +122,7 @@ public int getKeepAliveTime() /** * Sets the keepAliveTime value. * - * @param an int value + * @param inKeepAliveTime an int value */ public void setKeepAliveTime(int inKeepAliveTime) { diff --git a/core/src/main/java/org/marketcetera/quickfix/FIXMessageFactory.java b/core/src/main/java/org/marketcetera/quickfix/FIXMessageFactory.java index aecf43adf0..6de93546b8 100644 --- a/core/src/main/java/org/marketcetera/quickfix/FIXMessageFactory.java +++ b/core/src/main/java/org/marketcetera/quickfix/FIXMessageFactory.java @@ -254,7 +254,7 @@ public Message newMarketDataIncrementalRefresh(String inRequestId) /** * Create an MDEntry group. * - * @param inMessageFactory a FIXMessageFactory value + * @param inMsgType a String value * @param inMdEntryType a char value * @return a Group value */ @@ -270,7 +270,7 @@ public Group createMdEntryGroup(String inMsgType, * Get the MDEntry groups from the given message. * * @param inMessage a Message value - * @return a List<:Group> value + * @return a List<Group> value * @throws FieldNotFound if the groups could not be extracted */ public List getMdEntriesFromMessage(Message inMessage) diff --git a/core/src/main/java/org/marketcetera/symbol/IterativeSymbolResolver.java b/core/src/main/java/org/marketcetera/symbol/IterativeSymbolResolver.java index 903b1ea637..6a3e0418d1 100644 --- a/core/src/main/java/org/marketcetera/symbol/IterativeSymbolResolver.java +++ b/core/src/main/java/org/marketcetera/symbol/IterativeSymbolResolver.java @@ -120,7 +120,7 @@ public int getCacheSize() /** * Sets the cacheSize value. * - * @param an int value + * @param inCacheSize an int value */ public void setCacheSize(int inCacheSize) { diff --git a/core/src/main/java/org/marketcetera/symbol/SymbolResolver.java b/core/src/main/java/org/marketcetera/symbol/SymbolResolver.java index c0711cfad5..2d229e6fea 100644 --- a/core/src/main/java/org/marketcetera/symbol/SymbolResolver.java +++ b/core/src/main/java/org/marketcetera/symbol/SymbolResolver.java @@ -26,7 +26,7 @@ public interface SymbolResolver * Generate a symbol from the given instrument. * * @param inInstrument an Instrument value - * @return a code>String value + * @return a String value */ String generateSymbol(Instrument inInstrument); } diff --git a/core/src/main/java/org/marketcetera/trade/AbstractSuggestion.java b/core/src/main/java/org/marketcetera/trade/AbstractSuggestion.java new file mode 100644 index 0000000000..a666fdee64 --- /dev/null +++ b/core/src/main/java/org/marketcetera/trade/AbstractSuggestion.java @@ -0,0 +1,74 @@ +package org.marketcetera.trade; + +import java.math.BigDecimal; + +/* $License$ */ + +/** + * Provides common behavior for Suggestion implementations. + * + * @author Colin DuPlantis + * @version $Id$ + * @since $Release$ + */ +public abstract class AbstractSuggestion + implements Suggestion +{ + /* (non-Javadoc) + * @see org.marketcetera.trade.Suggestion#getIdentifier() + */ + @Override + public String getIdentifier() + { + return identifier; + } + /* (non-Javadoc) + * @see org.marketcetera.trade.Suggestion#setIdentifier(java.lang.String) + */ + @Override + public void setIdentifier(String inIdentifier) + { + identifier = inIdentifier; + } + /* (non-Javadoc) + * @see org.marketcetera.trade.Suggestion#getScore() + */ + @Override + public BigDecimal getScore() + { + return score; + } + /* (non-Javadoc) + * @see org.marketcetera.trade.Suggestion#setScore(java.math.BigDecimal) + */ + @Override + public void setScore(BigDecimal inScore) + { + score = inScore; + } + /** + * Create a new AbstractSuggestion instance. + */ + protected AbstractSuggestion() {} + /** + * Create a new AbstractSuggestion instance. + * + * @param inIdentifier a String value + * @param inScore a BigDecimal value + */ + protected AbstractSuggestion(String inIdentifier, + BigDecimal inScore) + { + setIdentifier(inIdentifier); + setScore(inScore); + } + /** + * identifier value + */ + private String identifier; + /** + * score value + */ + private BigDecimal score; + private static final long serialVersionUID = 7713915144622410613L; +} diff --git a/core/src/main/java/org/marketcetera/trade/Factory.java b/core/src/main/java/org/marketcetera/trade/Factory.java index 7912e65781..cec44fb464 100644 --- a/core/src/main/java/org/marketcetera/trade/Factory.java +++ b/core/src/main/java/org/marketcetera/trade/Factory.java @@ -55,6 +55,20 @@ public abstract OrderSingle createOrderSingle( */ public abstract OrderSingleSuggestion createOrderSingleSuggestion(); + /** + * Creates a suggestion for a cancel order. + * + * @return an OrderCancelSuggestion value + */ + public abstract OrderCancelSuggestion createOrderCancelSuggestion(); + + /** + * Creates a suggestion for a replace order. + * + * @return an OrderReplaceSuggestion value + */ + public abstract OrderReplaceSuggestion createOrderReplaceSuggestion(); + /** * Creates an order to cancel a previously placed order as * identified by the supplied execution report. The execution diff --git a/core/src/main/java/org/marketcetera/trade/FactoryImpl.java b/core/src/main/java/org/marketcetera/trade/FactoryImpl.java index ef023618a3..feded57fe7 100644 --- a/core/src/main/java/org/marketcetera/trade/FactoryImpl.java +++ b/core/src/main/java/org/marketcetera/trade/FactoryImpl.java @@ -45,7 +45,22 @@ public OrderSingle createOrderSingle() { public OrderSingleSuggestion createOrderSingleSuggestion() { return new OrderSingleSuggestionImpl(); } - + /* (non-Javadoc) + * @see org.marketcetera.trade.Factory#createOrderCancelSuggestion() + */ + @Override + public OrderCancelSuggestion createOrderCancelSuggestion() + { + return new OrderCancelSuggestionImpl(); + } + /* (non-Javadoc) + * @see org.marketcetera.trade.Factory#createOrderReplaceSuggestion() + */ + @Override + public OrderReplaceSuggestion createOrderReplaceSuggestion() + { + return new OrderReplaceSuggestionImpl(); + } @Override public OrderCancel createOrderCancel(ExecutionReport inLatestReport) { OrderCancelImpl order = new OrderCancelImpl(); diff --git a/core/src/main/java/org/marketcetera/trade/Instrument.java b/core/src/main/java/org/marketcetera/trade/Instrument.java index 498c7f0a91..b2530f3c15 100644 --- a/core/src/main/java/org/marketcetera/trade/Instrument.java +++ b/core/src/main/java/org/marketcetera/trade/Instrument.java @@ -16,7 +16,7 @@ * Each instrument has a symbol attribute. Sub-types may add more * attributes as needed to uniquely identify the instrument being traded. *

- * Each instrument sub-type should override the {@link #equals(Object)} & + * Each instrument sub-type should override the {@link #equals(Object)} & * {@link #hashCode()} methods to ensure that any two instrument instances that * refer to the same instrument are considered equal. * diff --git a/core/src/main/java/org/marketcetera/trade/OrderCancelSuggestion.java b/core/src/main/java/org/marketcetera/trade/OrderCancelSuggestion.java new file mode 100644 index 0000000000..5c4dc9ec21 --- /dev/null +++ b/core/src/main/java/org/marketcetera/trade/OrderCancelSuggestion.java @@ -0,0 +1,23 @@ +package org.marketcetera.trade; + +/* $License$ */ + +/** + * Contains a suggestion for a cancel order. + * + *

Instances of this type can be created via {@link Factory#createOrderCancelSuggestion()} + * + * @author Colin DuPlantis + * @version $Id$ + * @since $Release$ + */ +public interface OrderCancelSuggestion + extends Suggestion,HasOrderCancel +{ + /** + * Set the cancel order value. + * + * @param inOrderCancel the suggested order. + */ + void setOrderCancel(OrderCancel inOrderCancel); +} diff --git a/core/src/main/java/org/marketcetera/trade/OrderCancelSuggestionImpl.java b/core/src/main/java/org/marketcetera/trade/OrderCancelSuggestionImpl.java new file mode 100644 index 0000000000..9fd3a1b8fd --- /dev/null +++ b/core/src/main/java/org/marketcetera/trade/OrderCancelSuggestionImpl.java @@ -0,0 +1,78 @@ +package org.marketcetera.trade; + +import java.math.BigDecimal; + +/* $License$ */ + +/** + * Provides an {@link OrderCancelSuggestion} implementation. + * + * @author Colin DuPlantis + * @version $Id$ + * @since $Release$ + */ +public class OrderCancelSuggestionImpl + extends AbstractSuggestion + implements OrderCancelSuggestion +{ + /** + * Create a new OrderCancelSuggestionImpl instance. + */ + public OrderCancelSuggestionImpl() {} + /** + * Create a new OrderCancelSuggestionImpl instance. + * + * @param inOrderCancel an OrderCancel value + */ + public OrderCancelSuggestionImpl(OrderCancel inOrderCancel) + { + setOrderCancel(inOrderCancel); + } + /** + * Create a new OrderCancelSuggestionImpl instance. + * + * @param inIdentifier a String value + * @param inScore a BigDecimal value + * @param inOrderCancel an OrderCancel value + */ + public OrderCancelSuggestionImpl(String inIdentifier, + BigDecimal inScore, + OrderCancel inOrderCancel) + { + super(inIdentifier, + inScore); + setOrderCancel(inOrderCancel); + } + /* (non-Javadoc) + * @see org.marketcetera.trade.HasOrderCancel#getOrderCancel() + */ + @Override + public OrderCancel getOrderCancel() + { + return orderCancel; + } + /* (non-Javadoc) + * @see org.marketcetera.trade.OrderCancelSuggestion#setOrderCancel(org.marketcetera.trade.OrderCancel) + */ + @Override + public void setOrderCancel(OrderCancel inOrderCancel) + { + orderCancel = inOrderCancel; + } + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() + { + StringBuilder builder = new StringBuilder(); + builder.append("OrderCancelSuggestionImpl [identifier=").append(getIdentifier()).append(", score=") + .append(getScore()).append(", orderCancel=").append(orderCancel).append("]"); + return builder.toString(); + } + /** + * order Cancel value + */ + private OrderCancel orderCancel; + private static final long serialVersionUID = 2069691082438028206L; +} diff --git a/core/src/main/java/org/marketcetera/trade/OrderReplaceSuggestionImpl.java b/core/src/main/java/org/marketcetera/trade/OrderReplaceSuggestionImpl.java new file mode 100644 index 0000000000..a04c56a27a --- /dev/null +++ b/core/src/main/java/org/marketcetera/trade/OrderReplaceSuggestionImpl.java @@ -0,0 +1,78 @@ +package org.marketcetera.trade; + +import java.math.BigDecimal; + +/* $License$ */ + +/** + * Provides an {@link OrderReplaceSuggestion} implementation. + * + * @author Colin DuPlantis + * @version $Id$ + * @since $Release$ + */ +public class OrderReplaceSuggestionImpl + extends AbstractSuggestion + implements OrderReplaceSuggestion +{ + /** + * Create a new OrderReplaceSuggestionImpl instance. + */ + public OrderReplaceSuggestionImpl() {} + /** + * Create a new OrderReplaceSuggestionImpl instance. + * + * @param inOrderReplace an OrderReplace value + */ + public OrderReplaceSuggestionImpl(OrderReplace inOrderReplace) + { + setOrderReplace(inOrderReplace); + } + /** + * Create a new OrderReplaceSuggestionImpl instance. + * + * @param inIdentifier a String value + * @param inScore a BigDecimal value + * @param inOrderReplace an OrderReplace value + */ + public OrderReplaceSuggestionImpl(String inIdentifier, + BigDecimal inScore, + OrderReplace inOrderReplace) + { + super(inIdentifier, + inScore); + setOrderReplace(inOrderReplace); + } + /* (non-Javadoc) + * @see org.marketcetera.trade.HasOrderReplace#getOrderReplace() + */ + @Override + public OrderReplace getOrderReplace() + { + return orderReplace; + } + /* (non-Javadoc) + * @see org.marketcetera.trade.OrderReplaceSuggestion#setOrderReplace(org.marketcetera.trade.OrderReplace) + */ + @Override + public void setOrderReplace(OrderReplace inOrderReplace) + { + orderReplace = inOrderReplace; + } + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() + { + StringBuilder builder = new StringBuilder(); + builder.append("OrderReplaceSuggestionImpl [identifier=").append(getIdentifier()).append(", score=") + .append(getScore()).append(", orderReplace=").append(orderReplace).append("]"); + return builder.toString(); + } + /** + * order replace value + */ + private OrderReplace orderReplace; + private static final long serialVersionUID = 2069691082438028206L; +} diff --git a/core/src/main/java/org/marketcetera/trade/utils/OrderHistoryManager.java b/core/src/main/java/org/marketcetera/trade/utils/OrderHistoryManager.java index b6beb7c09b..0389664f83 100644 --- a/core/src/main/java/org/marketcetera/trade/utils/OrderHistoryManager.java +++ b/core/src/main/java/org/marketcetera/trade/utils/OrderHistoryManager.java @@ -94,7 +94,7 @@ public ReportBase getLatestReportFor(OrderID inOrderID) /** * Adds the given TradeMessage to the order history. * - * @param inReport a TradeMessage value + * @param inTradeMessage a TradeMessage value */ public void add(TradeMessage inTradeMessage) { @@ -319,10 +319,10 @@ public String display() *

The returned Deque does not change and will not reflect future changes. * *

The given OrderID may be either an order ID or an original order ID. The reports - * returned will be the same in either case. If no history exists for the given OrderID, + * returned will be the same in either case. If no history exists for the given OrderID, * an empty Deque is returned. * - *

The underlying order history is populated by calls to {@link #add(ReportBase)}. + *

The underlying order history is populated by calls to {@link #add(TradeMessage)}. * * @param inOrderId an OrderID value * @return a Deque<ReportBase> value which may be empty diff --git a/core/src/test/java/org/marketcetera/core/AccessViolator.java b/core/src/test/java/org/marketcetera/core/AccessViolator.java index 3d231a4b6d..1d66debc7d 100644 --- a/core/src/test/java/org/marketcetera/core/AccessViolator.java +++ b/core/src/test/java/org/marketcetera/core/AccessViolator.java @@ -37,9 +37,15 @@ public Object invokeMethod(String methodName, Object reference, Object [] args, theMethod.setAccessible(true); return theMethod.invoke(reference, args); } - - - /** Sets the speicified field to the passed-in value */ + /** + * Sets the specified field to the passed-in value + * + * @param fieldName a String value + * @param reference an Object value + * @param value an Object value + * @throws NoSuchFieldException if the specified field does not exist + * @throws IllegalAccessException if access is not allowed + */ public void setField(String fieldName, Object reference, Object value) throws NoSuchFieldException, IllegalAccessException { Field theField = violatedClass.getDeclaredField(fieldName); diff --git a/core/src/test/java/org/marketcetera/core/ExpectedTestFailure.java b/core/src/test/java/org/marketcetera/core/ExpectedTestFailure.java index 8cfd5fbe57..3ef336a453 100644 --- a/core/src/test/java/org/marketcetera/core/ExpectedTestFailure.java +++ b/core/src/test/java/org/marketcetera/core/ExpectedTestFailure.java @@ -10,7 +10,7 @@ *

  *  (new ExpectedTestFailure(OrderParsingException.class) {
  *    protected void execute() throws OrderParsingException {
- *       <... Code throwing exception goes here ... >
+ *       <... Code throwing exception goes here ... >
  *  }}).run();
  * 
* @@ -35,11 +35,15 @@ public ExpectedTestFailure(Class inThrowable, String inContains) /** Subclasses must override this method with an implementation that * throws their expected error - * @throws Throwable + * @throws Throwable if an error occurs */ protected abstract void execute() throws Throwable; - /** Executes the code that was implemented in @link {execute()} method */ + /** + * Executes the code that was implemented in @link {execute()} method. + * + * @return a Throwable value + */ public Throwable run() { try { diff --git a/core/src/test/java/org/marketcetera/core/ExpectedTestFailureTest.java b/core/src/test/java/org/marketcetera/core/ExpectedTestFailureTest.java index 7fb026d923..e0eb9d74d4 100644 --- a/core/src/test/java/org/marketcetera/core/ExpectedTestFailureTest.java +++ b/core/src/test/java/org/marketcetera/core/ExpectedTestFailureTest.java @@ -51,8 +51,11 @@ protected void execute() throws Throwable } - - /** Check the case when the exception has a message (toString()) but getMessage() returns null */ + /** + * Check the case when the exception has a message (toString()) but getMessage() returns null. + * + * @throws Exception an Exception value + */ public void testExceptinoHasNoMessageButHasString() throws Exception { final Exception ex = new Exception() { private static final long serialVersionUID = 1L; diff --git a/core/src/test/java/org/marketcetera/core/LoggerStartupTest.java b/core/src/test/java/org/marketcetera/core/LoggerStartupTest.java index 84f16e768a..b6a3d5b1e1 100644 --- a/core/src/test/java/org/marketcetera/core/LoggerStartupTest.java +++ b/core/src/test/java/org/marketcetera/core/LoggerStartupTest.java @@ -20,7 +20,7 @@ public static Test suite() { /** This is a dummy test, mostly for visual checking of whether or not * the logger is initialized correctly. - * @throws Exception + * @throws Exception if an unexpected error occurs */ public void testLogSomething() throws Exception { new ApplicationBase(); diff --git a/core/src/test/java/org/marketcetera/core/VersionInfoTest.java b/core/src/test/java/org/marketcetera/core/VersionInfoTest.java index eb53a4eb98..bb3d621031 100644 --- a/core/src/test/java/org/marketcetera/core/VersionInfoTest.java +++ b/core/src/test/java/org/marketcetera/core/VersionInfoTest.java @@ -13,7 +13,7 @@ /* $License$ */ /** - * Tests {@link #VersionInfo}. + * Tests {@link VersionInfo}. * * @author Colin DuPlantis * @version $Id$ diff --git a/core/src/test/java/org/marketcetera/core/instruments/InstrumentToMessageTest.java b/core/src/test/java/org/marketcetera/core/instruments/InstrumentToMessageTest.java index 3fb6f0e765..8a9b2de22d 100644 --- a/core/src/test/java/org/marketcetera/core/instruments/InstrumentToMessageTest.java +++ b/core/src/test/java/org/marketcetera/core/instruments/InstrumentToMessageTest.java @@ -604,7 +604,7 @@ protected void run() } } /** - * Tests {@link InstrumentToMessage#setSecurityType(org.marketcetera.trade.Instrument, String, quickfix.Message)}. + * Tests {@link InstrumentToMessage#setSecurityType(org.marketcetera.trade.Instrument, String, quickfix.FieldMap)}. * * @throws Exception if there were unexpected errors. */ diff --git a/core/src/test/java/org/marketcetera/core/notifications/NotificationManagerTest.java b/core/src/test/java/org/marketcetera/core/notifications/NotificationManagerTest.java index 8a1d1e823c..3b864f3342 100644 --- a/core/src/test/java/org/marketcetera/core/notifications/NotificationManagerTest.java +++ b/core/src/test/java/org/marketcetera/core/notifications/NotificationManagerTest.java @@ -26,7 +26,7 @@ public class NotificationManagerTest /** * Tests that the static getter returns a non-null value. * - * @throws Exception + * @throws Exception if an unexpected error occurs */ @Test public void testGetter() @@ -40,7 +40,7 @@ public void testGetter() *

Note that this is not an exhaustive test of the {@link PublisherEngine} because * that is covered in {@link PublisherEngineTest}. * - * @throws Exception + * @throws Exception if an unexpected error occurs */ @Test public void testSubscribeAndPublish() diff --git a/core/src/test/java/org/marketcetera/core/position/impl/OrderingComparison.java b/core/src/test/java/org/marketcetera/core/position/impl/OrderingComparison.java index 9161d829d5..51e546a0b3 100644 --- a/core/src/test/java/org/marketcetera/core/position/impl/OrderingComparison.java +++ b/core/src/test/java/org/marketcetera/core/position/impl/OrderingComparison.java @@ -49,36 +49,56 @@ else if (compare == 0) { /** * Is value = expected? + * + * @param type being compared + * @param value a T value + * @return a Matcher<? super T> value */ public static > Matcher comparesEqualTo(T value) { return new OrderingComparison(value, 0, 0); } /** - * Is value > expected? + * Is value > expected? + * + * @param type being compared + * @param value a T value + * @return a Matcher<? super T> value */ public static > Matcher greaterThan(T value) { return new OrderingComparison(value, -1, -1); } /** - * Is value >= expected? + * Is value >= expected? + * + * @param type being compared + * @param value a T value + * @return a Matcher<? super T> value */ public static > Matcher greaterThanOrEqualTo(T value) { return new OrderingComparison(value, -1, 0); } /** - * Is value < expected? + * Is value < expected? + * + * @param type being compared + * @param value a T value + * @return a Matcher<? super T> value */ public static > Matcher lessThan(T value) { return new OrderingComparison(value, 1, 1); } /** - * Is value <= expected? + * Is value <= expected? + * + * @param type being compared + * @param value a T value + * @return a Matcher<? super T> value */ public static > Matcher lessThanOrEqualTo(T value) { return new OrderingComparison(value, 0, 1); } -} \ No newline at end of file +} diff --git a/core/src/test/java/org/marketcetera/core/position/impl/PositionRowUpdaterConcurrencyTest.java b/core/src/test/java/org/marketcetera/core/position/impl/PositionRowUpdaterConcurrencyTest.java index ac822bdfef..390df5f30e 100644 --- a/core/src/test/java/org/marketcetera/core/position/impl/PositionRowUpdaterConcurrencyTest.java +++ b/core/src/test/java/org/marketcetera/core/position/impl/PositionRowUpdaterConcurrencyTest.java @@ -260,6 +260,8 @@ public final void run() { /** * Hook for subclass code to run. Any thrown exception will be reported. + * + * @throws Exception if an unexpected error occurs */ protected abstract void runWithReporting() throws Exception; } diff --git a/core/src/test/java/org/marketcetera/event/MockEvent.java b/core/src/test/java/org/marketcetera/event/MockEvent.java index a7f88c3ee6..ea9fc0423a 100644 --- a/core/src/test/java/org/marketcetera/event/MockEvent.java +++ b/core/src/test/java/org/marketcetera/event/MockEvent.java @@ -28,8 +28,8 @@ public MockEvent() /** * Create a new MockEvent instance. * - * @param inMessageId - * @param inTimestamp + * @param inMessageId a long value + * @param inTimestamp a long value */ public MockEvent(long inMessageId, long inTimestamp) @@ -40,7 +40,7 @@ public MockEvent(long inMessageId, /** * Create a new MockEvent instance. * - * @param inRequest + * @param inRequest a MarketDataRequest value */ public MockEvent(MarketDataRequest inRequest) { diff --git a/core/src/test/java/org/marketcetera/event/MockEventTranslator.java b/core/src/test/java/org/marketcetera/event/MockEventTranslator.java index 3d0107c535..daad985f35 100644 --- a/core/src/test/java/org/marketcetera/event/MockEventTranslator.java +++ b/core/src/test/java/org/marketcetera/event/MockEventTranslator.java @@ -99,7 +99,7 @@ public static void setTranslateToEventsReturnsNull(boolean inTranslateToEventsRe /** * Sets the requestToReturn value. * - * @param a DataRequest value + * @param inRequestToReturn a DataRequest value */ public static void setRequestToReturn(MarketDataRequest inRequestToReturn) { diff --git a/core/src/test/java/org/marketcetera/event/QuantityTuple.java b/core/src/test/java/org/marketcetera/event/QuantityTuple.java index 6bdfa4b05a..74115f82c1 100644 --- a/core/src/test/java/org/marketcetera/event/QuantityTuple.java +++ b/core/src/test/java/org/marketcetera/event/QuantityTuple.java @@ -29,6 +29,7 @@ public class QuantityTuple * * @param inPrice a BigDecimal value * @param inSize a BigDecimal value + * @param inType a Class<? extends MarketDataEvent> value */ public QuantityTuple(BigDecimal inPrice, BigDecimal inSize, @@ -59,7 +60,7 @@ public BigDecimal getSize() /** * Get the type value. * - * @return a Class value + * @return a Class<? extends MarketDataEvent> value */ public Class getType() { diff --git a/core/src/test/java/org/marketcetera/event/beans/DividendBeanTest.java b/core/src/test/java/org/marketcetera/event/beans/DividendBeanTest.java index 01b50fb5ea..f2d34c4324 100644 --- a/core/src/test/java/org/marketcetera/event/beans/DividendBeanTest.java +++ b/core/src/test/java/org/marketcetera/event/beans/DividendBeanTest.java @@ -64,7 +64,7 @@ public void equity() bean.getInstrumentAsString()); } /** - * Tests {@link DividendBean#getAmount()} and {@link DividendBean#setAmount(org.marketcetera.trade.Amount)}. + * Tests {@link DividendBean#getAmount()} and {@link DividendBean#setAmount(BigDecimal)}. * * @throws Exception if an unexpected error occurs */ @@ -82,7 +82,7 @@ public void amount() bean.getAmount()); } /** - * Tests {@link DividendBean#getCurrency()} and {@link DividendBean#setCurrency(org.marketcetera.trade.Currency)}. + * Tests {@link DividendBean#getCurrency()} and {@link DividendBean#setCurrency(String)}. * * @throws Exception if an unexpected error occurs */ @@ -100,7 +100,7 @@ public void currency() bean.getCurrency()); } /** - * Tests {@link DividendBean#getDeclareDate()} and {@link DividendBean#setDeclareDate(org.marketcetera.trade.DeclareDate)}. + * Tests {@link DividendBean#getDeclareDate()} and {@link DividendBean#setDeclareDate(String)}. * * @throws Exception if an unexpected error occurs */ @@ -121,7 +121,7 @@ public void declareDate() bean.getDeclareDate()); } /** - * Tests {@link DividendBean#getExecutionDate()} and {@link DividendBean#setExecutionDate(org.marketcetera.trade.ExecutionDate)}. + * Tests {@link DividendBean#getExecutionDate()} and {@link DividendBean#setExecutionDate(String)}. * * @throws Exception if an unexpected error occurs */ @@ -142,7 +142,7 @@ public void executionDate() bean.getExecutionDate()); } /** - * Tests {@link DividendBean#getPaymentDate()} and {@link DividendBean#setPaymentDate(org.marketcetera.trade.PaymentDate)}. + * Tests {@link DividendBean#getPaymentDate()} and {@link DividendBean#setPaymentDate(String)}. * * @throws Exception if an unexpected error occurs */ @@ -163,7 +163,7 @@ public void paymentDate() bean.getPaymentDate()); } /** - * Tests {@link DividendBean#getRecordDate()} and {@link DividendBean#setRecordDate(org.marketcetera.trade.RecordDate)}. + * Tests {@link DividendBean#getRecordDate()} and {@link DividendBean#setRecordDate(String)}. * * @throws Exception if an unexpected error occurs */ @@ -184,7 +184,7 @@ public void recordDate() bean.getRecordDate()); } /** - * Tests {@link DividendBean#getFrequency()} and {@link DividendBean#setFrequency(org.marketcetera.trade.Frequency)}. + * Tests {@link DividendBean#getFrequency()} and {@link DividendBean#setFrequency(DividendFrequency)}. * * @throws Exception if an unexpected error occurs */ @@ -202,7 +202,7 @@ public void frequency() bean.getFrequency()); } /** - * Tests {@link DividendBean#getStatus()} and {@link DividendBean#setStatus(org.marketcetera.trade.Status)}. + * Tests {@link DividendBean#getStatus()} and {@link DividendBean#setStatus(DividendStatus)}. * * @throws Exception if an unexpected error occurs */ @@ -220,7 +220,7 @@ public void status() bean.getStatus()); } /** - * Tests {@link DividendBean#getType()} and {@link DividendBean#setType(org.marketcetera.trade.Type)}. + * Tests {@link DividendBean#getType()} and {@link DividendBean#setType(DividendType)}. * * @throws Exception if an unexpected error occurs */ diff --git a/core/src/test/java/org/marketcetera/event/beans/MarketDataBeanTest.java b/core/src/test/java/org/marketcetera/event/beans/MarketDataBeanTest.java index 525d34b908..407966482d 100644 --- a/core/src/test/java/org/marketcetera/event/beans/MarketDataBeanTest.java +++ b/core/src/test/java/org/marketcetera/event/beans/MarketDataBeanTest.java @@ -40,7 +40,7 @@ public void copy() doCopyTest(new MarketDataBean()); } /** - * Tests {@link E#getInstrument()} and {@link E#setInstrument(org.marketcetera.trade.Instrument)}. + * Tests getInstrument and setInstrument. * * @throws Exception if an unexpected error occurs */ diff --git a/core/src/test/java/org/marketcetera/event/beans/MarketstatBeanTest.java b/core/src/test/java/org/marketcetera/event/beans/MarketstatBeanTest.java index 00df104aa0..7dd5758cb8 100644 --- a/core/src/test/java/org/marketcetera/event/beans/MarketstatBeanTest.java +++ b/core/src/test/java/org/marketcetera/event/beans/MarketstatBeanTest.java @@ -365,7 +365,7 @@ public void closeExchange() bean.getCloseExchange()); } /** - * Tests {@link E#getInstrument()} and {@link E#setInstrument(org.marketcetera.trade.Instrument)}. + * Tests getInstrument and setInstrument. * * @throws Exception if an unexpected error occurs */ diff --git a/core/src/test/java/org/marketcetera/event/beans/QuoteBeanTest.java b/core/src/test/java/org/marketcetera/event/beans/QuoteBeanTest.java index f1c9e6c3dd..83cbd92fb3 100644 --- a/core/src/test/java/org/marketcetera/event/beans/QuoteBeanTest.java +++ b/core/src/test/java/org/marketcetera/event/beans/QuoteBeanTest.java @@ -47,7 +47,7 @@ public void copy() } /** * Tests {@link QuoteBean#getQuoteBeanFromEvent(org.marketcetera.event.QuoteEvent, QuoteAction)} and - * {@link QuoteBean#getQuoteBeanFromEvent(org.marketcetera.event.QuoteEvent, java.util.Date, java.math.BigDecimal, QuoteAction). + * {@link QuoteBean#getQuoteBeanFromEvent(org.marketcetera.event.QuoteEvent, java.util.Date, java.math.BigDecimal, QuoteAction)}. * * @throws Exception if an unexpected error occurs */ diff --git a/core/src/test/java/org/marketcetera/event/impl/LogEventTest.java b/core/src/test/java/org/marketcetera/event/impl/LogEventTest.java index f3f6aeb456..9d93ea3264 100644 --- a/core/src/test/java/org/marketcetera/event/impl/LogEventTest.java +++ b/core/src/test/java/org/marketcetera/event/impl/LogEventTest.java @@ -26,7 +26,7 @@ import org.marketcetera.util.log.I18NMessageNP; /** - * Tests {@link LogEventBuilder} and {@link LinkEventImpl}. + * Tests {@link LogEventBuilder} and {@link LogEventImpl}. * * @author Colin DuPlantis * @version $Id$ diff --git a/core/src/test/java/org/marketcetera/event/impl/QuoteEventTest.java b/core/src/test/java/org/marketcetera/event/impl/QuoteEventTest.java index 97f42ba041..2e635f8e0c 100644 --- a/core/src/test/java/org/marketcetera/event/impl/QuoteEventTest.java +++ b/core/src/test/java/org/marketcetera/event/impl/QuoteEventTest.java @@ -550,7 +550,7 @@ public void withContractSize() verify(builder); } /** - * Tests {@link QuoteEventBuilder#withInstrument(Instrument)}. + * Tests QuoteEventBuilder.withInstrument. * * @throws Exception if an unexpected error occurs */ @@ -624,7 +624,7 @@ public void withMessageId() verify(builder); } /** - * Tests {@link QuoteEventBuilder#withMultiplier(int)}. + * Tests {@link QuoteEventBuilder#withMultiplier(BigDecimal)}. * * @throws Exception if an unexpected error occurs */ @@ -720,7 +720,7 @@ public void withPrice() verify(builder); } /** - * Tests {@link QuoteEventBuilder#withQuoteDate(String)}. + * Tests {@link QuoteEventBuilder#withQuoteDate(Date)}. * * @throws Exception if an unexpected error occurs */ diff --git a/core/src/test/java/org/marketcetera/event/impl/TradeEventTest.java b/core/src/test/java/org/marketcetera/event/impl/TradeEventTest.java index 3ee9c9e447..53ab1b94db 100644 --- a/core/src/test/java/org/marketcetera/event/impl/TradeEventTest.java +++ b/core/src/test/java/org/marketcetera/event/impl/TradeEventTest.java @@ -350,7 +350,7 @@ public void withMessageId() verify(builder); } /** - * Tests {@link TradeEventBuilder#withMultiplier(int)}. + * Tests {@link TradeEventBuilder#withMultiplier(BigDecimal)}. * * @throws Exception if an unexpected error occurs */ @@ -398,7 +398,7 @@ public void withPrice() verify(builder); } /** - * Tests {@link TradeEventBuilder#withTradeDate(String)}. + * Tests {@link TradeEventBuilder#withTradeDate(Date)}. * * @throws Exception if an unexpected error occurs */ diff --git a/core/src/test/java/org/marketcetera/marketdata/DateUtilsTest.java b/core/src/test/java/org/marketcetera/marketdata/DateUtilsTest.java index 06adda3515..2fd519086b 100644 --- a/core/src/test/java/org/marketcetera/marketdata/DateUtilsTest.java +++ b/core/src/test/java/org/marketcetera/marketdata/DateUtilsTest.java @@ -23,7 +23,7 @@ /* $License$ */ /** - * Tests {@link DateUtil}. + * Tests {@link DateUtils}. * * @author Colin DuPlantis * @version $Id$ diff --git a/core/src/test/java/org/marketcetera/marketdata/MarketDataRequestTest.java b/core/src/test/java/org/marketcetera/marketdata/MarketDataRequestTest.java index ac203ab03c..3f0916ace5 100644 --- a/core/src/test/java/org/marketcetera/marketdata/MarketDataRequestTest.java +++ b/core/src/test/java/org/marketcetera/marketdata/MarketDataRequestTest.java @@ -922,7 +922,7 @@ protected void run() } /** * Tests {@link MarketDataRequestBuilder#withContent(String)}, {@link MarketDataRequestBuilder#withContent(String...)}, - * {@link MarketDataRequestBuilder#withContent(Content...), and {@link MarketDataRequestBuilder#withContent(Collection)}. + * {@link MarketDataRequestBuilder#withContent(Content...)}, and {@link MarketDataRequestBuilder#withContent(Collection)}. * * @throws Exception if an unexpected error occurs */ diff --git a/core/src/test/java/org/marketcetera/marketdata/MockMarketDataFeed.java b/core/src/test/java/org/marketcetera/marketdata/MockMarketDataFeed.java index 6e4767ba65..e21a46ad32 100644 --- a/core/src/test/java/org/marketcetera/marketdata/MockMarketDataFeed.java +++ b/core/src/test/java/org/marketcetera/marketdata/MockMarketDataFeed.java @@ -133,7 +133,7 @@ public void setCapabilities(Set inCapabilities) /** * Sets the supported asset classes for this feed. * - * @param inAssetClasses a Set<AssetClass> value + * @param inAssetClasses a Set<AssetClass> value */ public void setAssetClasses(Set inAssetClasses) { @@ -277,7 +277,7 @@ public boolean getLoginFails() /** * Sets the allowLogin value. * - * @param a TestMarketDataFeed value + * @param inAllowLogin a TestMarketDataFeed value */ public void setLoginFails(boolean inAllowLogin) { @@ -297,7 +297,7 @@ public boolean isInitFails() /** * Sets the initFails value. * - * @param a TestMarketDataFeed value + * @param inInitFails a TestMarketDataFeed value */ public void setInitFails(boolean inInitFails) { @@ -333,7 +333,7 @@ public boolean getExecutionFails() /** * Sets the executionFails value. * - * @param a TestMarketDataFeed value + * @param inExecutionFails a TestMarketDataFeed value */ public void setExecutionFails(boolean inExecutionFails) { @@ -383,7 +383,7 @@ public boolean isCancelFails() /** * Sets the cancelFails value. * - * @param a TestMarketDataFeed value + * @param inCancelFails a TestMarketDataFeed value */ public void setCancelFails(boolean inCancelFails) { @@ -518,7 +518,7 @@ public boolean getShouldTimeout() /** * Sets the timeout value. * - * @param a TestMarketDataFeed value + * @param inTimeout a TestMarketDataFeed value */ public void setShouldTimeout(boolean inTimeout) { diff --git a/core/src/test/java/org/marketcetera/metrics/InfoTests.java b/core/src/test/java/org/marketcetera/metrics/InfoTests.java index 2fc3e2d783..5efd61d897 100644 --- a/core/src/test/java/org/marketcetera/metrics/InfoTests.java +++ b/core/src/test/java/org/marketcetera/metrics/InfoTests.java @@ -9,7 +9,7 @@ /* $License$ */ /** - * Tests {@link CheckpointInfo}, {@link IterationInfo} & {@link PerThreadInfo}. + * Tests {@link CheckpointInfo}, {@link IterationInfo} & {@link PerThreadInfo}. * * @author anshul@marketcetera.com * @version $Id$ diff --git a/core/src/test/java/org/marketcetera/metrics/PrintStreamFactoryTest.java b/core/src/test/java/org/marketcetera/metrics/PrintStreamFactoryTest.java index 76e27d48d8..fd9151026e 100644 --- a/core/src/test/java/org/marketcetera/metrics/PrintStreamFactoryTest.java +++ b/core/src/test/java/org/marketcetera/metrics/PrintStreamFactoryTest.java @@ -12,7 +12,7 @@ /* $License$ */ /** - * Tests {@link PrintStreamFactory} subclasses, {@link FileStreamFactory} & + * Tests {@link PrintStreamFactory} subclasses, {@link FileStreamFactory} & * {@link StdErrFactory} * * @author anshul@marketcetera.com diff --git a/core/src/test/java/org/marketcetera/module/DataFlowTest.java b/core/src/test/java/org/marketcetera/module/DataFlowTest.java index 72a0329987..0e04409e86 100644 --- a/core/src/test/java/org/marketcetera/module/DataFlowTest.java +++ b/core/src/test/java/org/marketcetera/module/DataFlowTest.java @@ -97,7 +97,7 @@ protected void run() throws Exception { } /** - * Tests creation & cancellation of simple data flows through the module + * Tests creation & cancellation of simple data flows through the module * manager API. * * @throws Exception if there's an unexpected error. @@ -172,7 +172,7 @@ public void emitFailStoppedFlow() throws Exception { } /** - * Tests creation & cancellation of simple data flows through the + * Tests creation & cancellation of simple data flows through the * data flow support interface. * * @throws Exception if there's an unexpected error. @@ -270,7 +270,7 @@ protected void run() throws Exception { /** * Verifies that attempts to invoke data flow setup/cancel APIs, in * {@link DataFlowSupport}, from within - * {@link DataEmitter#requestData(DataRequest, DataEmitterSupport)} & + * {@link DataEmitter#requestData(DataRequest, DataEmitterSupport)} & * {@link DataEmitter#cancel(DataFlowID, RequestID)} fails. * * @throws Exception if there were errors. diff --git a/core/src/test/java/org/marketcetera/module/ExpectedFailure.java b/core/src/test/java/org/marketcetera/module/ExpectedFailure.java index 70e7b2f3f6..0f227298af 100644 --- a/core/src/test/java/org/marketcetera/module/ExpectedFailure.java +++ b/core/src/test/java/org/marketcetera/module/ExpectedFailure.java @@ -199,7 +199,7 @@ protected ExpectedFailure(String inMessage, boolean inExactMatch) /** * Subclasses should implement this method to execute * code that is expected to fail with the exception of type - * T + * T. * * @throws Exception if there's a failure. */ diff --git a/core/src/test/java/org/marketcetera/module/LifecycleTest.java b/core/src/test/java/org/marketcetera/module/LifecycleTest.java index e1418ffb45..34b8d76c95 100644 --- a/core/src/test/java/org/marketcetera/module/LifecycleTest.java +++ b/core/src/test/java/org/marketcetera/module/LifecycleTest.java @@ -20,7 +20,7 @@ /* $License$ */ /** - * Tests Module provider and module lifecycle & information reporting. + * Tests Module provider and module lifecycle & information reporting. * * @author anshul@marketcetera.com */ diff --git a/core/src/test/java/org/marketcetera/module/ModuleConcurrencyTest.java b/core/src/test/java/org/marketcetera/module/ModuleConcurrencyTest.java index 1ae84a3ffe..b926662395 100644 --- a/core/src/test/java/org/marketcetera/module/ModuleConcurrencyTest.java +++ b/core/src/test/java/org/marketcetera/module/ModuleConcurrencyTest.java @@ -276,7 +276,7 @@ protected void run() throws Exception { } /** - * Tests locking & module operations when module start takes a long time + * Tests locking & module operations when module start takes a long time * to complete and succeeds. * * @throws Exception if there were errors. @@ -306,7 +306,7 @@ public void moduleBlockedPreStartPass() throws Exception { getManager().deleteModule(urn); } /** - * Tests locking & module operations when module start takes a long time + * Tests locking & module operations when module start takes a long time * to complete and fails. * * @throws Exception if there were errors. @@ -338,7 +338,7 @@ protected void run() throws Exception { getManager().deleteModule(urn); } /** - * Tests locking & module operations when module's setFlowSupport + * Tests locking & module operations when module's setFlowSupport * API takes a lot of time. Do note that setFlowSupport is meant * to be doing anything complicated. This unit test is there to * verify that the system is robust enough to deal with a rogue @@ -372,7 +372,7 @@ public void moduleBlockedSetFlowSupport() throws Exception { } /** - * Verifies locking & module operations when stopping module instances. + * Verifies locking & module operations when stopping module instances. * * @throws Exception if there were errors */ @@ -399,7 +399,7 @@ public void moduleBlockedPreStopPass() throws Exception { } /** - * Verifies locking & module operations when stopping module instance fails. + * Verifies locking & module operations when stopping module instance fails. * * @throws Exception if there were errors */ diff --git a/core/src/test/java/org/marketcetera/module/ProviderLoadTest.java b/core/src/test/java/org/marketcetera/module/ProviderLoadTest.java index b37864bc4a..2fe998fa5e 100644 --- a/core/src/test/java/org/marketcetera/module/ProviderLoadTest.java +++ b/core/src/test/java/org/marketcetera/module/ProviderLoadTest.java @@ -26,7 +26,7 @@ public void cleanup() throws Exception { mManager.stop(); } /** - * Tests various failures in {@link ModuleManager#init()} & + * Tests various failures in {@link ModuleManager#init()} & * {@link ModuleManager#refresh()} * and their expected behavior. * diff --git a/core/src/test/java/org/marketcetera/options/OptionUtilsTest.java b/core/src/test/java/org/marketcetera/options/OptionUtilsTest.java index 1b6b0a9cb3..06c99d9f16 100644 --- a/core/src/test/java/org/marketcetera/options/OptionUtilsTest.java +++ b/core/src/test/java/org/marketcetera/options/OptionUtilsTest.java @@ -30,7 +30,7 @@ public class OptionUtilsTest { /** - * Verifies {@link OptionUtils#normalizeEquityOptionExpiry(String)} & + * Verifies {@link OptionUtils#normalizeEquityOptionExpiry(String)} & * {@link OptionUtils#normalizeUSEquityOptionExpiry(String)}. * * @throws Exception if there were unexpected errors diff --git a/core/src/test/java/org/marketcetera/trade/utils/OrderHistoryManagerTest.java b/core/src/test/java/org/marketcetera/trade/utils/OrderHistoryManagerTest.java index b128383a25..e51ba9ace6 100644 --- a/core/src/test/java/org/marketcetera/trade/utils/OrderHistoryManagerTest.java +++ b/core/src/test/java/org/marketcetera/trade/utils/OrderHistoryManagerTest.java @@ -116,7 +116,7 @@ public void testGetLatestReportFor() assertNull(manager.getLatestReportFor(new OrderID("some-orderid-that-doesn't-exist"))); } /** - * Tests {@link OrderHistoryManager#add(ReportBase)}. + * Tests {@link OrderHistoryManager#add(TradeMessage)}. * * @throws Exception if an unexpected error occurs */ @@ -555,7 +555,7 @@ public void testOrderChain() assertTrue(report6OrderChain.isEmpty()); } /** - * Tests {@link LiveOrderHistoryManager#getOpenOrders()}. + * Tests {@link OrderHistoryManager#getOpenOrders()}. * * @throws Exception if an unexpected error occurs */ diff --git a/dare/.gitignore b/dare/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/dare/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/dare/src/main/java/org/marketcetera/dare/DeployAnywhereRoutingEngine.java b/dare/src/main/java/org/marketcetera/dare/DeployAnywhereRoutingEngine.java index c69462f2a9..2317ec82f2 100644 --- a/dare/src/main/java/org/marketcetera/dare/DeployAnywhereRoutingEngine.java +++ b/dare/src/main/java/org/marketcetera/dare/DeployAnywhereRoutingEngine.java @@ -650,7 +650,7 @@ public void sessionDisabled(FixSessionDisabledEvent inEvent) /** * Indicates that the given FIX session has been enabled. * - * @param fixSession a FixSessionEnabledEvent value + * @param inEvent a FixSessionEnabledEvent value */ @Subscribe public void sessionEnabled(FixSessionEnabledEvent inEvent) diff --git a/dare/src/test/java/org/marketcetera/test/AbstractMockFixApplication.java b/dare/src/test/java/org/marketcetera/test/AbstractMockFixApplication.java index 0b0959e0d1..b2529d4bfa 100644 --- a/dare/src/test/java/org/marketcetera/test/AbstractMockFixApplication.java +++ b/dare/src/test/java/org/marketcetera/test/AbstractMockFixApplication.java @@ -322,7 +322,7 @@ public void setFixSettingsProviderFactory(FixSettingsProviderFactory inFixSettin * * @param inSessionId a quickfix.SessionID value * @param inMessage a quickfix.Message value - * @param inMessageContainers a Map<quickfix.SessionID,BlockingDeque<quickfix.Message>> + * @param inMessageContainers a Map<quickfix.SessionID,BlockingDeque<quickfix.Message>> * @throws quickfix.FieldNotFound if the message could not be added */ protected void addMessageToContainer(String inLabel, diff --git a/dare/src/test/java/org/marketcetera/test/DareTestBase.java b/dare/src/test/java/org/marketcetera/test/DareTestBase.java index 61368baabe..9697c89ef5 100644 --- a/dare/src/test/java/org/marketcetera/test/DareTestBase.java +++ b/dare/src/test/java/org/marketcetera/test/DareTestBase.java @@ -566,7 +566,7 @@ public Boolean call() * @param inRootOrderId an OrderID value * @param inOrderId an OrderID value * @param inExpectedOrderStatus an OrderStatus value - * @param return an OrderSummary value + * @return an OrderSummary value * @throws Exception if an unexpected error occurs */ protected OrderSummary verifyOrderStatus(final OrderID inRootOrderId, @@ -595,7 +595,7 @@ public Boolean call() * * @param inRootOrderId an OrderID value * @param inOrderId an OrderID value - * @param return an OrderSummary value + * @return an OrderSummary value * @throws Exception if an unexpected error occurs */ protected OrderSummary findOrderStatus(final OrderID inRootOrderId, @@ -2701,8 +2701,6 @@ public quickfix.Message generateAndSendReport(quickfix.Message inMessage, * Generate and send an ack for the given new order. * * @param inMessage a quickfix.Message value - * @param inOrderStatus an OrderStatus value - * @param inExecutionType an ExecutionType value * @return a quickfix.Message value * @throws Exception if the message could not be sent */ @@ -2714,14 +2712,11 @@ public quickfix.Message generateAndSendAck(quickfix.Message inMessage) ExecutionType.New); } /** - * - * + * Generate and send a cancel ack for the given order. * - * @param inMessage - * @param inOrderStatus - * @param inExecutionType - * @return - * @throws Exception + * @param inMessage a quickfix.Message value + * @return a quickfix.Message value + * @throws Exception if the message could not be sent */ public quickfix.Message generateAndSendCancelAck(quickfix.Message inMessage) throws Exception diff --git a/dare/src/test/java/org/marketcetera/test/TestDirectoryManager.java b/dare/src/test/java/org/marketcetera/test/TestDirectoryManager.java index 937fcc2ac0..62ff5be8bd 100644 --- a/dare/src/test/java/org/marketcetera/test/TestDirectoryManager.java +++ b/dare/src/test/java/org/marketcetera/test/TestDirectoryManager.java @@ -22,7 +22,7 @@ public class TestDirectoryManager /** * Get the testDirectories value. * - * @return a List value + * @return a List<String> value */ public List getTestDirectories() { @@ -31,7 +31,7 @@ public List getTestDirectories() /** * Sets the testDirectories value. * - * @param inTestDirectories a List value + * @param inTestDirectories a List<String> value */ public void setTestDirectories(List inTestDirectories) { @@ -40,7 +40,7 @@ public void setTestDirectories(List inTestDirectories) /** * Get the deleteDirectories value. * - * @return a List value + * @return a List<String> value */ public List getDeleteDirectories() { @@ -49,7 +49,7 @@ public List getDeleteDirectories() /** * Sets the deleteDirectories value. * - * @param inDeleteDirectories a List value + * @param inDeleteDirectories a List<String> value */ public void setDeleteDirectories(List inDeleteDirectories) { diff --git a/dataflow/dataflow-api/.gitignore b/dataflow/dataflow-api/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/dataflow/dataflow-api/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/dataflow/dataflow-core/.gitignore b/dataflow/dataflow-core/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/dataflow/dataflow-core/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/dataflow/dataflow-rpc-client/.gitignore b/dataflow/dataflow-rpc-client/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/dataflow/dataflow-rpc-client/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/dataflow/dataflow-rpc-core/.gitignore b/dataflow/dataflow-rpc-core/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/dataflow/dataflow-rpc-core/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/dataflow/dataflow-rpc-server/.gitignore b/dataflow/dataflow-rpc-server/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/dataflow/dataflow-rpc-server/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/dataflow/dataflow-server/.gitignore b/dataflow/dataflow-server/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/dataflow/dataflow-server/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/eventbus/eventbus-api/.gitignore b/eventbus/eventbus-api/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/eventbus/eventbus-api/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/eventbus/eventbus-core/.gitignore b/eventbus/eventbus-core/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/eventbus/eventbus-core/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/eventbus/eventbus-guava/.gitignore b/eventbus/eventbus-guava/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/eventbus/eventbus-guava/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/eventbus/eventbus-server/.gitignore b/eventbus/eventbus-server/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/eventbus/eventbus-server/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/fix/fix-acceptor/.gitignore b/fix/fix-acceptor/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/fix/fix-acceptor/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/fix/fix-api/.gitignore b/fix/fix-api/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/fix/fix-api/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/fix/fix-api/src/main/java/org/marketcetera/brokers/LogoutAction.java b/fix/fix-api/src/main/java/org/marketcetera/brokers/LogoutAction.java index 953e3e3f2c..ab2c3890e7 100644 --- a/fix/fix-api/src/main/java/org/marketcetera/brokers/LogoutAction.java +++ b/fix/fix-api/src/main/java/org/marketcetera/brokers/LogoutAction.java @@ -20,6 +20,6 @@ public interface LogoutAction * @param inFixSession a ServerFixSession value * @param inSender a QuickFIXSender value */ - public void onLogout(ServerFixSession FixSession, + public void onLogout(ServerFixSession inFixSession, QuickFIXSender inSender); } diff --git a/fix/fix-api/src/main/java/org/marketcetera/brokers/service/BrokerService.java b/fix/fix-api/src/main/java/org/marketcetera/brokers/service/BrokerService.java index 1fa145fc14..66435c0baf 100644 --- a/fix/fix-api/src/main/java/org/marketcetera/brokers/service/BrokerService.java +++ b/fix/fix-api/src/main/java/org/marketcetera/brokers/service/BrokerService.java @@ -135,8 +135,8 @@ void reportBrokerStatusFromAll(FixSession inFixSession, /** * Finds the fix session corresponding to the given broker ID. * - * @param inBrokerId a String value - * @return a FixSession value or null + * @param inBrokerId a String value + * @return a FixSession value or null */ FixSession findFixSessionByBrokerId(BrokerID inBrokerId); /** @@ -168,7 +168,7 @@ void reportBrokerStatusFromAll(FixSession inFixSession, */ AcceptorSessionAttributes getFixSettingsFor(int inAffinity); /** - * Generates a SessionSettings value based on the given collection of fix sessions. + * Generates a SessionSettings value based on the given collection of fix sessions. * * @param inFixSessions a Collection<FixSession> value * @return a SessionSettings value diff --git a/fix/fix-api/src/main/java/org/marketcetera/brokers/service/FixSessionProvider.java b/fix/fix-api/src/main/java/org/marketcetera/brokers/service/FixSessionProvider.java index e763f48eec..27daf8914d 100644 --- a/fix/fix-api/src/main/java/org/marketcetera/brokers/service/FixSessionProvider.java +++ b/fix/fix-api/src/main/java/org/marketcetera/brokers/service/FixSessionProvider.java @@ -25,14 +25,14 @@ public interface FixSessionProvider /** * Finds the fix session corresponding to the given name. * - * @param inFixSessionName a String value - * @return a FixSession value or null + * @param inFixSessionName a String value + * @return a FixSession value or null */ FixSession findFixSessionByName(String inFixSessionName); /** * Finds the fix session with the given session id. * - * @param inFixSessionListener a FixSessionListener value + * @param inSessionId a SessionID value * @return a FixSession value or null */ FixSession findFixSessionBySessionId(SessionID inSessionId); @@ -58,8 +58,8 @@ public interface FixSessionProvider /** * Finds the fix session corresponding to the given broker ID. * - * @param inBrokerId a String value - * @return a FixSession value or null + * @param inBrokerId a BrokerID value + * @return a FixSession value or null */ FixSession findFixSessionByBrokerId(BrokerID inBrokerId); /** diff --git a/fix/fix-api/src/main/java/org/marketcetera/fix/ActiveFixSessionFactory.java b/fix/fix-api/src/main/java/org/marketcetera/fix/ActiveFixSessionFactory.java index 2d6228226c..8ed129a8c8 100644 --- a/fix/fix-api/src/main/java/org/marketcetera/fix/ActiveFixSessionFactory.java +++ b/fix/fix-api/src/main/java/org/marketcetera/fix/ActiveFixSessionFactory.java @@ -24,9 +24,9 @@ public interface ActiveFixSessionFactory /** * Create an ActiveFixSession object. * - * @param inFixSession a FixSession value - * @param inClusterData a ClusterData value - * @param inStatus a FixSessionStatus value + * @param inUnderlyingFixSession a FixSession value + * @param inInstanceData a ClusterData value + * @param inBrokerStatus a FixSessionStatus value * @param inSessionCustomization a SessionCustomization value * @return an ActiveFixSession value */ diff --git a/fix/fix-api/src/main/java/org/marketcetera/fix/FixSessionStatus.java b/fix/fix-api/src/main/java/org/marketcetera/fix/FixSessionStatus.java index ae6f534b18..d83bf2f6ef 100644 --- a/fix/fix-api/src/main/java/org/marketcetera/fix/FixSessionStatus.java +++ b/fix/fix-api/src/main/java/org/marketcetera/fix/FixSessionStatus.java @@ -5,6 +5,8 @@ import javax.xml.bind.annotation.XmlRootElement; +import org.apache.commons.lang3.StringUtils; + /* $License$ */ /** @@ -95,12 +97,37 @@ public boolean isLoggedOn() * @return a String value */ public String getHumanReadable() + { + return humanReadableName; + } + /** + * Generate a human readable version of the value. + * + * @return a String value + */ + private String generateHumanReadable() { String name = name(); name = name.toLowerCase(); name = name.replaceAll("_"," "); + StringBuilder output = new StringBuilder(); + for(String component : name.split(" ")) { + output.append(StringUtils.capitalize(component)).append(" "); + } + name = StringUtils.trim(output.toString()); return name; } + /** + * Create a new FixSessionStatus instance. + */ + private FixSessionStatus() + { + humanReadableName = generateHumanReadable(); + } + /** + * stored human-readable version of the status + */ + private final String humanReadableName; /** * contains the statuses that indicate if a session is started or not */ diff --git a/fix/fix-api/src/main/java/org/marketcetera/fix/MutableActiveFixSession.java b/fix/fix-api/src/main/java/org/marketcetera/fix/MutableActiveFixSession.java index ab187cc773..8c0e583cc6 100644 --- a/fix/fix-api/src/main/java/org/marketcetera/fix/MutableActiveFixSession.java +++ b/fix/fix-api/src/main/java/org/marketcetera/fix/MutableActiveFixSession.java @@ -33,7 +33,7 @@ public interface MutableActiveFixSession /** * Set the session status. * - * @param inSessionStatus a FixSessionStatus value + * @param inFixSessionStatus a FixSessionStatus value */ void setStatus(FixSessionStatus inFixSessionStatus); /** @@ -51,7 +51,7 @@ public interface MutableActiveFixSession /** * Set the brokerAlgos value. * - * @param a Set<BrokerAlgoSpec> value + * @param inBrokerAlgoSpecs a Set<BrokerAlgoSpec> value */ void setBrokerAlgos(Set inBrokerAlgoSpecs); } diff --git a/fix/fix-api/src/main/java/org/marketcetera/fix/MutableActiveFixSessionFactory.java b/fix/fix-api/src/main/java/org/marketcetera/fix/MutableActiveFixSessionFactory.java index 4f2969bd4a..f8a2a6c4f1 100644 --- a/fix/fix-api/src/main/java/org/marketcetera/fix/MutableActiveFixSessionFactory.java +++ b/fix/fix-api/src/main/java/org/marketcetera/fix/MutableActiveFixSessionFactory.java @@ -32,9 +32,9 @@ public interface MutableActiveFixSessionFactory /** * Create a MutableActiveFixSession object. * - * @param inFixSession a FixSession value - * @param inClusterData a ClusterData value - * @param inStatus a FixSessionStatus value + * @param inUnderlyingFixSession a FixSession value + * @param inInstanceData a ClusterData value + * @param inBrokerStatus a FixSessionStatus value * @param inSessionCustomization a SessionCustomization value * @return a MutableActiveFixSession value */ diff --git a/fix/fix-api/src/main/java/org/marketcetera/fix/SessionNameProvider.java b/fix/fix-api/src/main/java/org/marketcetera/fix/SessionNameProvider.java index 1872e34ffc..9925dd6532 100644 --- a/fix/fix-api/src/main/java/org/marketcetera/fix/SessionNameProvider.java +++ b/fix/fix-api/src/main/java/org/marketcetera/fix/SessionNameProvider.java @@ -16,9 +16,9 @@ public interface SessionNameProvider /** * Get the name of the given session. * - * This method is intended to be light-weight to be called frequently with minimal trips to the database. + *

This method is intended to be light-weight to be called frequently with minimal trips to the database. * As such, it is possible that the value returned may, under certain circumstances, be inaccurate due to caching. - * This is unlikely to happen, but is possible due to the emphasis on performance. + * This is unlikely to happen, but is possible due to the emphasis on performance.

* * @param inSessionId a SessionID value * @return a String value, never null diff --git a/fix/fix-api/src/main/java/org/marketcetera/fix/SessionRestoreArbiter.java b/fix/fix-api/src/main/java/org/marketcetera/fix/SessionRestoreArbiter.java index b984c1e5a0..fd8c528d16 100644 --- a/fix/fix-api/src/main/java/org/marketcetera/fix/SessionRestoreArbiter.java +++ b/fix/fix-api/src/main/java/org/marketcetera/fix/SessionRestoreArbiter.java @@ -16,7 +16,7 @@ public interface SessionRestoreArbiter /** * Indicates if the given session should be restored or allowed to start as-is. * - * @param inSessionId a SessionID value + * @param inSessionId a SessionID value * @return a boolean */ boolean shouldRestore(SessionID inSessionId); diff --git a/fix/fix-core/.gitignore b/fix/fix-core/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/fix/fix-core/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/fix/fix-core/src/main/java/org/marketcetera/fix/FixSettingsProviderImpl.java b/fix/fix-core/src/main/java/org/marketcetera/fix/FixSettingsProviderImpl.java index 1d509df52b..dd681a2b23 100644 --- a/fix/fix-core/src/main/java/org/marketcetera/fix/FixSettingsProviderImpl.java +++ b/fix/fix-core/src/main/java/org/marketcetera/fix/FixSettingsProviderImpl.java @@ -27,7 +27,7 @@ public class FixSettingsProviderImpl * @param inLogFactoryClass a Class<LogFactory> value * @param inMessageFactory a MessageFactory value * @param inAcceptorHost a String value - * @param inAcceptorProtocol a String value + * @param inAcceptorProtocol a String value * @param inAcceptorPort an int value */ public FixSettingsProviderImpl(Class inMessageStoreFactoryClass, diff --git a/fix/fix-core/src/main/java/org/marketcetera/fix/impl/SimpleFixSessinInstanceData.java b/fix/fix-core/src/main/java/org/marketcetera/fix/impl/SimpleFixSessionInstanceData.java similarity index 97% rename from fix/fix-core/src/main/java/org/marketcetera/fix/impl/SimpleFixSessinInstanceData.java rename to fix/fix-core/src/main/java/org/marketcetera/fix/impl/SimpleFixSessionInstanceData.java index c1f3424921..e76d5ba23a 100644 --- a/fix/fix-core/src/main/java/org/marketcetera/fix/impl/SimpleFixSessinInstanceData.java +++ b/fix/fix-core/src/main/java/org/marketcetera/fix/impl/SimpleFixSessionInstanceData.java @@ -17,7 +17,7 @@ */ @XmlRootElement(name="fixSessionInstanceData") @XmlAccessorType(XmlAccessType.NONE) -public class SimpleFixSessinInstanceData +public class SimpleFixSessionInstanceData implements FixSessionInstanceData { /* (non-Javadoc) diff --git a/fix/fix-core/src/test/java/org/marketcetera/brokers/MockBrokerStatusGenerator.java b/fix/fix-core/src/test/java/org/marketcetera/brokers/MockBrokerStatusGenerator.java index fd745eba14..bafb0836fd 100644 --- a/fix/fix-core/src/test/java/org/marketcetera/brokers/MockBrokerStatusGenerator.java +++ b/fix/fix-core/src/test/java/org/marketcetera/brokers/MockBrokerStatusGenerator.java @@ -14,7 +14,7 @@ /* $License$ */ /** - * Generates test {@link BrokerStatus} values. + * Generates test {@link ActiveFixSession} values. * * @author Colin DuPlantis * @version $Id$ diff --git a/fix/fix-rpc-client/.gitignore b/fix/fix-rpc-client/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/fix/fix-rpc-client/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/fix/fix-rpc-core/.gitignore b/fix/fix-rpc-core/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/fix/fix-rpc-core/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/fix/fix-rpc-core/pom.xml b/fix/fix-rpc-core/pom.xml index 28723c3153..d431cbfe05 100644 --- a/fix/fix-rpc-core/pom.xml +++ b/fix/fix-rpc-core/pom.xml @@ -17,6 +17,10 @@ ${project.groupId} fix-api + + ${project.groupId} + fix-core + ${project.groupId} cluster-rpc-core diff --git a/fix/fix-rpc-core/src/main/java/org/marketcetera/fix/FixRpcUtil.java b/fix/fix-rpc-core/src/main/java/org/marketcetera/fix/FixRpcUtil.java index 01a3deb003..162a81d018 100644 --- a/fix/fix-rpc-core/src/main/java/org/marketcetera/fix/FixRpcUtil.java +++ b/fix/fix-rpc-core/src/main/java/org/marketcetera/fix/FixRpcUtil.java @@ -10,6 +10,7 @@ import org.marketcetera.cluster.ClusterDataFactory; import org.marketcetera.cluster.ClusterRpcUtil; import org.marketcetera.core.Validator; +import org.marketcetera.fix.impl.SimpleFixSessionInstanceData; import org.marketcetera.rpc.base.BaseRpcUtil; import org.marketcetera.util.log.SLF4JLoggerProxy; @@ -27,12 +28,18 @@ public class FixRpcUtil /** * Get instance data from the given RPC value. * - * @param inInstanceData an FixAdminRpc.InstanceData value + * @param inRpcInstanceData a FixAdminRpc.InstanceData value * @return an Optional<FixSessionInstanceData> value */ - public static Optional getInstanceData(FixAdminRpc.InstanceData inInstanceData) + public static Optional getInstanceData(FixAdminRpc.InstanceData inRpcInstanceData) { - throw new UnsupportedOperationException(); // TODO + if(inRpcInstanceData == null) { + return Optional.empty(); + } + SimpleFixSessionInstanceData instanceData = new SimpleFixSessionInstanceData(); + instanceData.setHostname(inRpcInstanceData.getHostname()); + instanceData.setPort(inRpcInstanceData.getPort()); + return Optional.of(instanceData); } /** * Get the value from the given RPC value. @@ -239,7 +246,7 @@ public static Optional getRpcActiveFixSession(Acti /** * Get the RPC value from the given value. * - * @param inBrokerAlgoSpec a BrokerAlgoSpec value + * @param inBrokerAlgoSpec a BrokerAlgoSpec value * @return an Optional<FixAdminRpc.BrokerAlgoSpec> value */ public static Optional getRpcBrokerAlgo(BrokerAlgoSpec inBrokerAlgoSpec) diff --git a/fix/fix-rpc-server/.gitignore b/fix/fix-rpc-server/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/fix/fix-rpc-server/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/fix/fix-rpc-server/src/main/java/org/marketcetera/fix/rpc/FixAdminRpcService.java b/fix/fix-rpc-server/src/main/java/org/marketcetera/fix/rpc/FixAdminRpcService.java index f53910f48d..59597f2e9e 100644 --- a/fix/fix-rpc-server/src/main/java/org/marketcetera/fix/rpc/FixAdminRpcService.java +++ b/fix/fix-rpc-server/src/main/java/org/marketcetera/fix/rpc/FixAdminRpcService.java @@ -623,6 +623,7 @@ public void getInstanceData(InstanceDataRequest inRequest, instanceDataBuilder.setHostname(acceptorSessionAttributes.getHost()); } instanceDataBuilder.setPort(acceptorSessionAttributes.getPort()); + responseBuilder.setInstanceData(instanceDataBuilder.build()); FixAdminRpc.InstanceDataResponse response = responseBuilder.build(); SLF4JLoggerProxy.trace(FixAdminRpcService.this, "Returning {}", diff --git a/fix/fix-server/.gitignore b/fix/fix-server/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/fix/fix-server/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/fix/fix-server/src/main/java/org/marketcetera/fix/provisioning/FixSessionsConfiguration.java b/fix/fix-server/src/main/java/org/marketcetera/fix/provisioning/FixSessionsConfiguration.java index 91b8ce6674..0f4848c144 100644 --- a/fix/fix-server/src/main/java/org/marketcetera/fix/provisioning/FixSessionsConfiguration.java +++ b/fix/fix-server/src/main/java/org/marketcetera/fix/provisioning/FixSessionsConfiguration.java @@ -27,7 +27,7 @@ public class FixSessionsConfiguration /** * Get the sessionDescriptors value. * - * @return a List value + * @return a List<FixSessionDescriptor> value */ public List getSessionDescriptors() { @@ -36,7 +36,7 @@ public List getSessionDescriptors() /** * Sets the sessionDescriptors value. * - * @param inSessionDescriptors a List value + * @param inSessionDescriptors a List<FixSessionDescriptor> value */ public void setSessionDescriptors(List inSessionDescriptors) { @@ -75,7 +75,7 @@ public String toString() /** * Get the settings value. * - * @return a Map value + * @return a Map<String,String> value */ public Map getSettings() { @@ -84,7 +84,7 @@ public Map getSettings() /** * Sets the settings value. * - * @param inSettings a Map value + * @param inSettings a Map<String,String> value */ public void setSettings(Map inSettings) { @@ -93,7 +93,7 @@ public void setSettings(Map inSettings) /** * Get the sessions value. * - * @return a List value + * @return a List<Session> value */ public List getSessions() { @@ -102,7 +102,7 @@ public List getSessions() /** * Sets the sessions value. * - * @param inSessions a List value + * @param inSessions a List<Session> value */ public void setSessions(List inSessions) { @@ -268,7 +268,7 @@ public void setAffinity(int inAffinity) /** * Get the settings value. * - * @return a Map value + * @return a Map<String,String> value */ public Map getSettings() { @@ -277,7 +277,7 @@ public Map getSettings() /** * Sets the settings value. * - * @param inSettings a Map value + * @param inSettings a Map<String,String> value */ public void setSettings(Map inSettings) { diff --git a/fix/fix-server/src/main/java/org/marketcetera/fix/provisioning/SimpleSessionCustomization.java b/fix/fix-server/src/main/java/org/marketcetera/fix/provisioning/SimpleSessionCustomization.java index 02686562b0..ce003755a0 100644 --- a/fix/fix-server/src/main/java/org/marketcetera/fix/provisioning/SimpleSessionCustomization.java +++ b/fix/fix-server/src/main/java/org/marketcetera/fix/provisioning/SimpleSessionCustomization.java @@ -118,7 +118,7 @@ public void setResponseModifiers(List inResponseModifiers) /** * Sets the brokerAlgos value. * - * @param inBrokerAlgos a Set value + * @param inBrokerAlgos a Set<BrokerAlgoSpec> value */ public void setBrokerAlgos(Set inBrokerAlgos) { @@ -127,7 +127,7 @@ public void setBrokerAlgos(Set inBrokerAlgos) /** * Sets the userWhitelist value. * - * @param inUserWhitelist a Set value + * @param inUserWhitelist a Set<String> value */ public void setUserWhitelist(Set inUserWhitelist) { @@ -136,7 +136,7 @@ public void setUserWhitelist(Set inUserWhitelist) /** * Sets the userBlacklist value. * - * @param inUserBlacklist a Set value + * @param inUserBlacklist a Set<String> value */ public void setUserBlacklist(Set inUserBlacklist) { diff --git a/fix/fix-server/src/test/java/org/marketcetera/fix/FixServerTestConfiguration.java b/fix/fix-server/src/test/java/org/marketcetera/fix/FixServerTestConfiguration.java index 3bab3ba9d9..e9c72a8ff2 100644 --- a/fix/fix-server/src/test/java/org/marketcetera/fix/FixServerTestConfiguration.java +++ b/fix/fix-server/src/test/java/org/marketcetera/fix/FixServerTestConfiguration.java @@ -5,8 +5,6 @@ import org.marketcetera.brokers.service.FixSessionProvider; import org.marketcetera.cluster.ClusterDataFactory; import org.marketcetera.cluster.SimpleClusterDataFactory; -import org.marketcetera.cluster.SimpleClusterService; -import org.marketcetera.cluster.service.ClusterService; import org.marketcetera.fix.dao.PersistentFixSessionFactory; import org.marketcetera.fix.dao.PersistentFixSessionProvider; import org.marketcetera.fix.impl.SimpleActiveFixSessionFactory; @@ -118,14 +116,4 @@ public MutableFixSessionFactory getFixSessionFactory() { return new PersistentFixSessionFactory(); } - /** - * Get the cluster service. - * - * @return a ClusterService value - */ - @Bean - public ClusterService getClusterService() - { - return new SimpleClusterService(); - } } diff --git a/fork/commons-csv/.gitignore b/fork/commons-csv/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/fork/commons-csv/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/fork/commons-csv/pom.xml b/fork/commons-csv/pom.xml index 0ff50e86e0..6d1f16725a 100644 --- a/fork/commons-csv/pom.xml +++ b/fork/commons-csv/pom.xml @@ -52,20 +52,6 @@ - - - - - - - - - - - - - - csv 12311182 @@ -94,14 +80,6 @@ - - org.apache.maven.plugins - maven-checkstyle-plugin - 3.1.2 - - checkstyle.xml - - diff --git a/fork/commons-csv/src/java/org/apache/commons/csv/CSVParser.java b/fork/commons-csv/src/java/org/apache/commons/csv/CSVParser.java index 839a9b2583..d6e7b4e4de 100644 --- a/fork/commons-csv/src/java/org/apache/commons/csv/CSVParser.java +++ b/fork/commons-csv/src/java/org/apache/commons/csv/CSVParser.java @@ -288,6 +288,9 @@ public int getLineNumber() { /** * Convenience method for nextToken(null). + * + * @return a Token value + * @throws IOException if an error occurs */ protected Token nextToken() throws IOException { return nextToken(new Token()); @@ -563,6 +566,7 @@ private int readEscape(int c) throws IOException { /** * Sets the specified CSV Strategy * + * @param strategy a CSVStrategy value * @return current instance of CSVParser to allow chained method calls * @deprecated the strategy should be set in the constructor {@link #CSVParser(Reader,CSVStrategy)}. */ diff --git a/fork/commons-csv/src/java/org/apache/commons/csv/CSVPrinter.java b/fork/commons-csv/src/java/org/apache/commons/csv/CSVPrinter.java index a57d03aef8..644f50150f 100644 --- a/fork/commons-csv/src/java/org/apache/commons/csv/CSVPrinter.java +++ b/fork/commons-csv/src/java/org/apache/commons/csv/CSVPrinter.java @@ -69,6 +69,7 @@ public CSVPrinter(Writer out) { /** * Sets the specified CSV Strategy * + * @param strategy a CSVStrategy value * @return current instance of CSVParser to allow chained method calls */ public CSVPrinter setStrategy(CSVStrategy strategy) { diff --git a/fork/commons-csv/src/java/org/apache/commons/csv/CSVStrategy.java b/fork/commons-csv/src/java/org/apache/commons/csv/CSVStrategy.java index 1b04d68b68..aeccd0118f 100644 --- a/fork/commons-csv/src/java/org/apache/commons/csv/CSVStrategy.java +++ b/fork/commons-csv/src/java/org/apache/commons/csv/CSVStrategy.java @@ -25,6 +25,7 @@ */ public class CSVStrategy implements Cloneable, Serializable { + private static final long serialVersionUID = -451433279415143890L; private char delimiter; private char encapsulator; private char commentStart; @@ -59,8 +60,10 @@ public CSVStrategy(char delimiter, char encapsulator, char commentStart) { * @param delimiter a Char used for value separation * @param encapsulator a Char used as value encapsulation marker * @param commentStart a Char used for comment identification + * @param escape a char value * @param ignoreLeadingWhitespace TRUE when leading whitespaces should be * ignored + * @param ignoreTrailingWhitespace a boolean value * @param interpretUnicodeEscapes TRUE when unicode escapes should be * interpreted * @param ignoreEmptyLines TRUE when the parser should skip emtpy lines @@ -84,8 +87,17 @@ public CSVStrategy( setUnicodeEscapeInterpretation(interpretUnicodeEscapes); setIgnoreEmptyLines(ignoreEmptyLines); } - - /** @deprecated */ + /** + * Create a new CSVStrategy instance. + * + * @param delimiter a char value + * @param encapsulator a char value + * @param commentStart a char value + * @param ignoreLeadingWhitespace a boolean value + * @param interpretUnicodeEscapes a boolean value + * @param ignoreEmptyLines a boolean value + * @deprecated + */ public CSVStrategy( char delimiter, char encapsulator, diff --git a/fork/commons-csv/src/java/org/apache/commons/csv/CharBuffer.java b/fork/commons-csv/src/java/org/apache/commons/csv/CharBuffer.java index c44b2641ff..1dadee8399 100644 --- a/fork/commons-csv/src/java/org/apache/commons/csv/CharBuffer.java +++ b/fork/commons-csv/src/java/org/apache/commons/csv/CharBuffer.java @@ -46,6 +46,8 @@ public CharBuffer() { /** * Creates a new CharBuffer with an initial capacity * of length characters. + * + * @param length an int value */ public CharBuffer(final int length) { if (length == 0) { @@ -171,7 +173,7 @@ public void trimTrailingWhitespace() { * modifying it. * This method allows to avoid copying if the caller knows the exact capacity * before. - * @return + * @return a char[] value */ public char[] getCharacters() { if (c.length == length) { @@ -182,9 +184,12 @@ public char[] getCharacters() { return chars; } - /** - * Returns the character at the specified position. - */ + /** + * Returns the character at the specified position. + * + * @param pos an int value + * @return a char value + */ public char charAt(int pos) { return c[pos]; } @@ -192,7 +197,8 @@ public char charAt(int pos) { /** * Converts the contents of the buffer into a StringBuffer. * This method involves copying the new data once! - * @return + * + * @return a StringBuffer value */ public StringBuffer toStringBuffer() { StringBuffer sb = new StringBuffer(length); @@ -203,7 +209,8 @@ public StringBuffer toStringBuffer() { /** * Converts the contents of the buffer into a StringBuffer. * This method involves copying the new data once! - * @return + * + * @return a String value */ public String toString() { return new String(c, 0, length); @@ -211,7 +218,8 @@ public String toString() { /** * Copies the data into a new array of at least capacity size. - * @param capacity + * + * @param capacity an int value */ public void provideCapacity(final int capacity) { if (c.length >= capacity) { diff --git a/fork/commons-csv/src/java/org/apache/commons/csv/writer/CSVConfig.java b/fork/commons-csv/src/java/org/apache/commons/csv/writer/CSVConfig.java index c1611e0b16..bf1ff5a9b1 100644 --- a/fork/commons-csv/src/java/org/apache/commons/csv/writer/CSVConfig.java +++ b/fork/commons-csv/src/java/org/apache/commons/csv/writer/CSVConfig.java @@ -278,7 +278,8 @@ public boolean isEndTrimmed() { /** * Specify if the end of the line needs to be trimmed. Defaults to false. - * @param endTrimmed + * + * @param endTrimmed a boolean value */ public void setEndTrimmed(boolean endTrimmed) { this.endTrimmed = endTrimmed; diff --git a/fork/commons-csv/src/java/org/apache/commons/csv/writer/CSVConfigGuesser.java b/fork/commons-csv/src/java/org/apache/commons/csv/writer/CSVConfigGuesser.java index 00c590baa3..d0f6282b29 100644 --- a/fork/commons-csv/src/java/org/apache/commons/csv/writer/CSVConfigGuesser.java +++ b/fork/commons-csv/src/java/org/apache/commons/csv/writer/CSVConfigGuesser.java @@ -115,7 +115,7 @@ protected void analyseLines(String[] lines) { /** * Guess if this file is fixedwidth. * Just basing the fact on all lines being of the same length - * @param lines + * @param lines a String[] value */ protected void guessFixedWidth(String[] lines) { int lastLength = 0; diff --git a/fork/commons-csv/src/java/org/apache/commons/csv/writer/CSVField.java b/fork/commons-csv/src/java/org/apache/commons/csv/writer/CSVField.java index a2f8ee43de..697192ebcd 100644 --- a/fork/commons-csv/src/java/org/apache/commons/csv/writer/CSVField.java +++ b/fork/commons-csv/src/java/org/apache/commons/csv/writer/CSVField.java @@ -103,7 +103,7 @@ public void setFill(int fill) { /** * Does this field override fill ? * - * @return + * @return a boolean value */ public boolean overrideFill() { return overrideFill; diff --git a/fork/commons-i18n/.gitignore b/fork/commons-i18n/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/fork/commons-i18n/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/fork/commons-i18n/pom.xml b/fork/commons-i18n/pom.xml index 7995ff3078..b77052c291 100644 --- a/fork/commons-i18n/pom.xml +++ b/fork/commons-i18n/pom.xml @@ -140,13 +140,6 @@ - diff --git a/fork/commons-i18n/src/java/org/apache/commons/i18n/JdbcMessageProvider.java b/fork/commons-i18n/src/java/org/apache/commons/i18n/JdbcMessageProvider.java index b4baaebb10..35157d4038 100644 --- a/fork/commons-i18n/src/java/org/apache/commons/i18n/JdbcMessageProvider.java +++ b/fork/commons-i18n/src/java/org/apache/commons/i18n/JdbcMessageProvider.java @@ -21,7 +21,7 @@ * accessible via JDBC. The JdbcMessageProvider only has support for different languages, * but if support for country or variant is required one could easily subclass it and override the * getLocale method. If getLocale is overridden, the languageColumn parameter - * (or jdbc.sql.locale.column Map entry) of the constructors may be null, since it will not be used. + * (or jdbc.sql.locale.column Map entry) of the constructors may be null, since it will not be used. * @author Mattias Jiderhamn */ public class JdbcMessageProvider implements MessageProvider { @@ -86,6 +86,10 @@ public JdbcMessageProvider(DataSource ds, String table, String idColumn, String * jdbc.sql.table = resources * jdbc.sql.locale.column = locale * jdbc.sql.key.column = msgKey + * + * @param properties a Properties value + * @throws ClassNotFoundException if an error occurs constructing the provider + * @throws SQLException if an error occurs constructing the provider */ public JdbcMessageProvider(Properties properties) throws ClassNotFoundException, SQLException { String driver = properties.getProperty("jdbc.connect.driver"); @@ -169,7 +173,10 @@ protected String[] getValueColumns(ResultSet rs) throws SQLException { * by subclasses to allow for proprietary interpretation of language data. * The default implementation assumes the column with the name provided as languageColumn * for the constructor contains the ISO-639 code. + * + * @param rs a ResultSet value * @return The Locale of the current ResultSet record. + * @throws SQLException if an error occurs getting the locale */ protected Locale getLocale(ResultSet rs) throws SQLException { return new Locale(rs.getString(languageColumn).toLowerCase()); diff --git a/fork/commons-i18n/src/java/org/apache/commons/i18n/MessageManager.java b/fork/commons-i18n/src/java/org/apache/commons/i18n/MessageManager.java index 3bb3c98ef3..a8091f85cb 100644 --- a/fork/commons-i18n/src/java/org/apache/commons/i18n/MessageManager.java +++ b/fork/commons-i18n/src/java/org/apache/commons/i18n/MessageManager.java @@ -223,6 +223,11 @@ public static String getText(String providerId, String id, String entry, Object[ * locale. The map contains keys of type {@link String}containing the keys * of the available message entries and values of type {@link String} * containing the localized message entries. + * + * @param id a String value + * @param locale a Locale value + * @return a Map<String,String> value + * @throws MessageNotFoundException if the desired message is not found */ public static Map getEntries(String id, Locale locale) @@ -242,12 +247,18 @@ public static Map getEntries(String id, throw exception; } - /** - * Returns a map containing all available message entries for the given - * locale. The map contains keys of type {@link String}containing the keys - * of the available message entries and values of type {@link String} - * containing the localized message entries. - */ + /** + * Returns a map containing all available message entries for the given + * locale. The map contains keys of type {@link String}containing the keys + * of the available message entries and values of type {@link String} + * containing the localized message entries. + * + * @param providerId a String value + * @param id a String value + * @param locale a Locale value + * @return a Map<String,String> value + * @throws MessageNotFoundException if the desired message is not found + */ public static Map getEntries(String providerId, String id, Locale locale) diff --git a/fork/commons-i18n/src/java/org/apache/commons/i18n/MessageNotFoundException.java b/fork/commons-i18n/src/java/org/apache/commons/i18n/MessageNotFoundException.java index c78d9f3f05..ec0c925163 100644 --- a/fork/commons-i18n/src/java/org/apache/commons/i18n/MessageNotFoundException.java +++ b/fork/commons-i18n/src/java/org/apache/commons/i18n/MessageNotFoundException.java @@ -31,6 +31,8 @@ * */ public class MessageNotFoundException extends RuntimeException { + private static final long serialVersionUID = 9044313257331004814L; + /** * Constructs a new runtime exception with the specified detail message indicating that a particular message * could not be found. @@ -54,7 +56,7 @@ public MessageNotFoundException(String message) { * @param message the detail message (which is saved for later retrieval * by the {@link #getMessage()} method). * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause()} method). (A null value is + * {@link #getCause()} method). (A null value is * permitted, and indicates that the cause is nonexistent or * unknown.) */ diff --git a/fork/commons-i18n/src/java/org/apache/commons/i18n/MessageProvider.java b/fork/commons-i18n/src/java/org/apache/commons/i18n/MessageProvider.java index 399a82b2d6..65fdaf25da 100644 --- a/fork/commons-i18n/src/java/org/apache/commons/i18n/MessageProvider.java +++ b/fork/commons-i18n/src/java/org/apache/commons/i18n/MessageProvider.java @@ -47,7 +47,7 @@ public interface MessageProvider { /** * @param id unique id that specifies a particular message * @param locale the locale for which to return the entries - * @return returns a map <entry(String) -> localized text(String) of + * @return returns a map <entry(String) -> localized text(String) of * message entries matching the given message id and locale * @throws MessageNotFoundException thrown if no message could be found matching the given message id */ diff --git a/fork/commons-i18n/src/java/org/apache/commons/i18n/ResourceBundleMessageProvider.java b/fork/commons-i18n/src/java/org/apache/commons/i18n/ResourceBundleMessageProvider.java index 09f46953f5..6d7f3cea54 100644 --- a/fork/commons-i18n/src/java/org/apache/commons/i18n/ResourceBundleMessageProvider.java +++ b/fork/commons-i18n/src/java/org/apache/commons/i18n/ResourceBundleMessageProvider.java @@ -65,7 +65,9 @@ public ResourceBundleMessageProvider(String baseName, } } /** + * Create a new ResourceBundleMessageProvider instance. * + * @param baseName a String value * @throws MessageNotFoundException Thrown if the resource bundle does not exist. */ public ResourceBundleMessageProvider(String baseName) throws MessageNotFoundException { diff --git a/fork/commons-i18n/src/test/org/apache/commons/i18n/MessageProviderTestBase.java b/fork/commons-i18n/src/test/org/apache/commons/i18n/MessageProviderTestBase.java index f8c5926000..0ed424a980 100644 --- a/fork/commons-i18n/src/test/org/apache/commons/i18n/MessageProviderTestBase.java +++ b/fork/commons-i18n/src/test/org/apache/commons/i18n/MessageProviderTestBase.java @@ -27,8 +27,8 @@ * If creating new implementations, consider subclassing this class to test the behaviour of that implementation. * The tests assume the provided MessageProvider * contains the following entries: - *

*

Transaction Module Factory capabilities
Provider URN:metc:core:transaction
Cardinality:Singleton
Instance URN:metc:core:transaction:single
+ * * * * @@ -70,7 +70,6 @@ * * *
Describes entries for the message provider
Language/LocaleIDThis entry is not translated to any other languages
- *

* Specifically, the ID nonExistentId and the entry nonExistentEntry of ID * helloWorld must NOT be existent. */ @@ -102,7 +101,7 @@ public void tearDown() throws Exception { /** * Test functionality of getText() method, which should be common for all implementations of the * MessageProvider interface. - * @param messageProvider + * @param messageProvider a MessageProvider value */ protected void testGetText(MessageProvider messageProvider) { // Explicit default locale diff --git a/fork/commons-i18n/src/test/org/apache/commons/i18n/MockProviderTestBase.java b/fork/commons-i18n/src/test/org/apache/commons/i18n/MockProviderTestBase.java index c983c8b9bd..4d1518fc3c 100644 --- a/fork/commons-i18n/src/test/org/apache/commons/i18n/MockProviderTestBase.java +++ b/fork/commons-i18n/src/test/org/apache/commons/i18n/MockProviderTestBase.java @@ -46,6 +46,8 @@ protected void addMockProvider() { /** * Add mock provider to MessageManager. + * + * @param providerId a String value */ protected void addMockProvider(final String providerId) { // Mock message provider that returns a string made up of the arguments passed to it. diff --git a/fork/commons-i18n/src/test/org/apache/commons/i18n/XMLMessageProviderTest.java b/fork/commons-i18n/src/test/org/apache/commons/i18n/XMLMessageProviderTest.java index 9d488e5682..b24d70dccf 100644 --- a/fork/commons-i18n/src/test/org/apache/commons/i18n/XMLMessageProviderTest.java +++ b/fork/commons-i18n/src/test/org/apache/commons/i18n/XMLMessageProviderTest.java @@ -108,6 +108,8 @@ public void testGetEntries() { /** * Constructor for MessageManagerTest. + * + * @param testName a String value */ public XMLMessageProviderTest(String testName) { super(testName); diff --git a/marketdata/marketdata-api/.gitignore b/marketdata/marketdata-api/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/marketdata/marketdata-api/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/marketdata/marketdata-api/src/main/java/org/marketcetera/marketdata/MarketDataClient.java b/marketdata/marketdata-api/src/main/java/org/marketcetera/marketdata/MarketDataClient.java index b2efae30fd..9ad635b17a 100644 --- a/marketdata/marketdata-api/src/main/java/org/marketcetera/marketdata/MarketDataClient.java +++ b/marketdata/marketdata-api/src/main/java/org/marketcetera/marketdata/MarketDataClient.java @@ -53,7 +53,7 @@ Deque getSnapshot(Instrument inInstrument, /** * Gets a subset of the most recent snapshot available of the given market data. * - *

Market data must be pre-requested via {@link #request(ClientContext, MarketDataRequest, boolean)}. + *

Market data must be pre-requested via {@link #request(MarketDataRequest, MarketDataListener)}.

* * @param inInstrument an Instrument value * @param inContent a Content value diff --git a/marketdata/marketdata-api/src/main/java/org/marketcetera/marketdata/MarketDataClientFactory.java b/marketdata/marketdata-api/src/main/java/org/marketcetera/marketdata/MarketDataClientFactory.java index adeff64252..104e529b46 100644 --- a/marketdata/marketdata-api/src/main/java/org/marketcetera/marketdata/MarketDataClientFactory.java +++ b/marketdata/marketdata-api/src/main/java/org/marketcetera/marketdata/MarketDataClientFactory.java @@ -16,7 +16,7 @@ public interface MarketDataClientFactory { /** - * Create a {@link MarketDataServiceClient} instance. + * Create a {@link MarketDataClient} instance. * * @param inParameters a ParameterClazz value * @return a MarketDataServiceClient value diff --git a/marketdata/marketdata-core/.gitignore b/marketdata/marketdata-core/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/marketdata/marketdata-core/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/marketdata/marketdata-core/src/main/java/org/marketcetera/marketdata/AbstractMarketDataModule.java b/marketdata/marketdata-core/src/main/java/org/marketcetera/marketdata/AbstractMarketDataModule.java index dde7910caa..97fd166af9 100644 --- a/marketdata/marketdata-core/src/main/java/org/marketcetera/marketdata/AbstractMarketDataModule.java +++ b/marketdata/marketdata-core/src/main/java/org/marketcetera/marketdata/AbstractMarketDataModule.java @@ -56,6 +56,7 @@ *

* Module Features * + * * * * @@ -351,7 +352,7 @@ protected void preStop() /** * Get the feed value. * - * @return a MarketDataFeed value + * @return a MarketDataFeed<T,C> value */ protected MarketDataFeed getFeed() { diff --git a/marketdata/marketdata-server/src/main/java/org/marketcetera/marketdata/core/provider/MarketDataCacheElement.java b/marketdata/marketdata-core/src/main/java/org/marketcetera/marketdata/MarketDataCacheElement.java similarity index 96% rename from marketdata/marketdata-server/src/main/java/org/marketcetera/marketdata/core/provider/MarketDataCacheElement.java rename to marketdata/marketdata-core/src/main/java/org/marketcetera/marketdata/MarketDataCacheElement.java index 0abc15948a..2f1b33877e 100644 --- a/marketdata/marketdata-server/src/main/java/org/marketcetera/marketdata/core/provider/MarketDataCacheElement.java +++ b/marketdata/marketdata-core/src/main/java/org/marketcetera/marketdata/MarketDataCacheElement.java @@ -1,4 +1,4 @@ -package org.marketcetera.marketdata.core.provider; +package org.marketcetera.marketdata; import java.util.ArrayList; import java.util.Collection; @@ -18,9 +18,6 @@ import org.marketcetera.event.TradeEvent; import org.marketcetera.event.impl.QuoteEventBuilder; import org.marketcetera.event.util.MarketstatEventCache; -import org.marketcetera.marketdata.Content; -import org.marketcetera.marketdata.OrderBook; -import org.marketcetera.marketdata.core.Messages; import org.marketcetera.trade.Instrument; import org.marketcetera.util.misc.ClassVersion; @@ -203,8 +200,6 @@ private void doBookUpdate(Content inContent, orderbook.process(quoteEvent); latestTop = orderbook.getTopOfBook(); inoutResults.add(quoteEvent); - } else { - throw new IllegalArgumentException(Messages.CONTENT_REQUIRES_QUOTE_EVENTS.getText(inContent,event.getClass().getName())); } } } diff --git a/marketdata/marketdata-core/src/main/java/org/marketcetera/marketdata/MarketDataProviderStatus.java b/marketdata/marketdata-core/src/main/java/org/marketcetera/marketdata/MarketDataProviderStatus.java index 1bbd342b2e..7c263a4f74 100644 --- a/marketdata/marketdata-core/src/main/java/org/marketcetera/marketdata/MarketDataProviderStatus.java +++ b/marketdata/marketdata-core/src/main/java/org/marketcetera/marketdata/MarketDataProviderStatus.java @@ -2,9 +2,6 @@ import java.io.Serializable; -import org.marketcetera.marketdata.FeedStatus; -import org.marketcetera.marketdata.MarketDataStatus; - /* $License$ */ /** @@ -36,7 +33,7 @@ public String getProvider() /** * Sets the provider value. * - * @param a String value + * @param inProvider a String value */ public void setProvider(String inProvider) { diff --git a/marketdata/marketdata-rpc-client/.gitignore b/marketdata/marketdata-rpc-client/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/marketdata/marketdata-rpc-client/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/marketdata/marketdata-rpc-core/.gitignore b/marketdata/marketdata-rpc-core/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/marketdata/marketdata-rpc-core/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/marketdata/marketdata-rpc-core/src/test/java/org/marketcetera/marketdata/rpc/MarketDataRpcUtilTest.java b/marketdata/marketdata-rpc-core/src/test/java/org/marketcetera/marketdata/rpc/MarketDataRpcUtilTest.java index e815bc064a..6d668e0f34 100644 --- a/marketdata/marketdata-rpc-core/src/test/java/org/marketcetera/marketdata/rpc/MarketDataRpcUtilTest.java +++ b/marketdata/marketdata-rpc-core/src/test/java/org/marketcetera/marketdata/rpc/MarketDataRpcUtilTest.java @@ -682,7 +682,7 @@ public static void verifyMarketDataEvent(MarketDataTypesRpc.MarketDataEvent inEx /** * Verify the given RPC event matches the given event. * - * @param inEvent a MarketDataTypesRpc.Event value + * @param inExpectedEvent a MarketDataTypesRpc.Event value * @param inActualEvent an Event value */ public static void verifyEvent(MarketDataTypesRpc.Event inExpectedEvent, diff --git a/marketdata/marketdata-rpc-server/.gitignore b/marketdata/marketdata-rpc-server/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/marketdata/marketdata-rpc-server/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/marketdata/marketdata-rpc-server/src/test/java/org/marketcetera/marketdata/rpc/MockMarketDataServiceAdapter.java b/marketdata/marketdata-rpc-server/src/test/java/org/marketcetera/marketdata/rpc/MockMarketDataServiceAdapter.java index 25e83cd4ee..85ef77b37a 100644 --- a/marketdata/marketdata-rpc-server/src/test/java/org/marketcetera/marketdata/rpc/MockMarketDataServiceAdapter.java +++ b/marketdata/marketdata-rpc-server/src/test/java/org/marketcetera/marketdata/rpc/MockMarketDataServiceAdapter.java @@ -243,7 +243,7 @@ public void reset() capabilityRequests.set(0); } /** - * Records requests to {@link MockMarketDataServiceAdapter#getSnapshot(Instrument, Content, String)}. + * Records requests to {@link MockMarketDataServiceAdapter#getSnapshot(Instrument, Content)}. * * @author Colin DuPlantis * @version $Id$ diff --git a/marketdata/marketdata-server/.gitignore b/marketdata/marketdata-server/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/marketdata/marketdata-server/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/marketdata/marketdata-server/src/main/java/org/marketcetera/marketdata/cache/MarketDataCacheModule.java b/marketdata/marketdata-server/src/main/java/org/marketcetera/marketdata/cache/MarketDataCacheModule.java index a6a1022074..f97f9d985a 100644 --- a/marketdata/marketdata-server/src/main/java/org/marketcetera/marketdata/cache/MarketDataCacheModule.java +++ b/marketdata/marketdata-server/src/main/java/org/marketcetera/marketdata/cache/MarketDataCacheModule.java @@ -4,7 +4,7 @@ import org.marketcetera.event.Event; import org.marketcetera.event.HasInstrument; import org.marketcetera.marketdata.Content; -import org.marketcetera.marketdata.core.provider.MarketDataCacheElement; +import org.marketcetera.marketdata.MarketDataCacheElement; import org.marketcetera.marketdata.service.MarketDataCacheManager; import org.marketcetera.marketdata.service.MarketDataCacheProvider; import org.marketcetera.module.AbstractDataReemitterModule; diff --git a/marketdata/marketdata-server/src/main/java/org/marketcetera/marketdata/core/manager/MarketDataManagerModule.java b/marketdata/marketdata-server/src/main/java/org/marketcetera/marketdata/core/manager/MarketDataManagerModule.java index 615cfcd021..b790f87cfa 100644 --- a/marketdata/marketdata-server/src/main/java/org/marketcetera/marketdata/core/manager/MarketDataManagerModule.java +++ b/marketdata/marketdata-server/src/main/java/org/marketcetera/marketdata/core/manager/MarketDataManagerModule.java @@ -10,9 +10,9 @@ import org.marketcetera.event.Event; import org.marketcetera.event.HasInstrument; import org.marketcetera.marketdata.Content; +import org.marketcetera.marketdata.MarketDataCacheElement; import org.marketcetera.marketdata.MarketDataRequest; import org.marketcetera.marketdata.core.Messages; -import org.marketcetera.marketdata.core.provider.MarketDataCacheElement; import org.marketcetera.module.AbstractDataReemitterModule; import org.marketcetera.module.DataFlowID; import org.marketcetera.module.DataFlowRequester; @@ -40,6 +40,7 @@ *

* Module Features *

Indicates the module features
CapabilitiesData Emitter
Stops data flowsNo
Start OperationStarts the feed, logs into it.
+ * * * * @@ -147,7 +148,7 @@ public long getSubscriberTimeout() /** * Sets the subscriberTimeout value. * - * @param a long value + * @param inSubscriberTimeout a long value */ public void setSubscriberTimeout(long inSubscriberTimeout) { diff --git a/marketdata/marketdata-server/src/main/java/org/marketcetera/marketdata/core/manager/MarketDataManagerModuleFactory.java b/marketdata/marketdata-server/src/main/java/org/marketcetera/marketdata/core/manager/MarketDataManagerModuleFactory.java index dc079047a8..90d78967e1 100644 --- a/marketdata/marketdata-server/src/main/java/org/marketcetera/marketdata/core/manager/MarketDataManagerModuleFactory.java +++ b/marketdata/marketdata-server/src/main/java/org/marketcetera/marketdata/core/manager/MarketDataManagerModuleFactory.java @@ -14,6 +14,7 @@ *

* Module Features *

MarketDataManagerModule Capabilites
CapabilitiesData Requester
Stops data flowsYes
Start OperationNone
+ * * * * diff --git a/marketdata/marketdata-server/src/main/java/org/marketcetera/marketdata/core/provider/MarketDataProviderWatcher.java b/marketdata/marketdata-server/src/main/java/org/marketcetera/marketdata/core/provider/MarketDataProviderWatcher.java index dd9696091a..74a6dcb558 100644 --- a/marketdata/marketdata-server/src/main/java/org/marketcetera/marketdata/core/provider/MarketDataProviderWatcher.java +++ b/marketdata/marketdata-server/src/main/java/org/marketcetera/marketdata/core/provider/MarketDataProviderWatcher.java @@ -119,7 +119,7 @@ public List getMarketDataStatusListeners() /** * Sets the marketDataStatusListeners value. * - * @param a List<MarketDataStatusListener> value + * @param inMarketDataStatusListeners a List<MarketDataStatusListener> value */ public void setMarketDataStatusListeners(List inMarketDataStatusListeners) { @@ -131,7 +131,6 @@ public void setMarketDataStatusListeners(List inMarket /* (non-Javadoc) * @see org.marketcetera.marketdata.core.provider.MarketDataStatusProvider#addMarketDataStatusListener(org.marketcetera.marketdata.core.provider.MarketDataStatusListener) */ -// @Override public void addMarketDataStatusListener(MarketDataStatusListener inMarketDataStatusListener) { marketDataStatusListeners.add(inMarketDataStatusListener); @@ -139,7 +138,6 @@ public void addMarketDataStatusListener(MarketDataStatusListener inMarketDataSta /* (non-Javadoc) * @see org.marketcetera.marketdata.core.provider.MarketDataStatusProvider#removeMarketDataStatusListener(org.marketcetera.marketdata.core.provider.MarketDataStatusListener) */ -// @Override public void removeMarketDataStatusListener(MarketDataStatusListener inMarketDataStatusListener) { marketDataStatusListeners.remove(inMarketDataStatusListener); @@ -147,7 +145,6 @@ public void removeMarketDataStatusListener(MarketDataStatusListener inMarketData /* (non-Javadoc) * @see org.marketcetera.marketdata.core.provider.MarketDataStatusProvider#isRunning() */ -// @Override public boolean isRunning() { return lastStatus; diff --git a/marketdata/marketdata-server/src/main/java/org/marketcetera/marketdata/service/MarketDataEventModuleConnectorFactory.java b/marketdata/marketdata-server/src/main/java/org/marketcetera/marketdata/service/MarketDataEventModuleConnectorFactory.java index b0ec1c26c1..d55a00cb88 100644 --- a/marketdata/marketdata-server/src/main/java/org/marketcetera/marketdata/service/MarketDataEventModuleConnectorFactory.java +++ b/marketdata/marketdata-server/src/main/java/org/marketcetera/marketdata/service/MarketDataEventModuleConnectorFactory.java @@ -12,7 +12,8 @@ * ModuleFactory implementation for the MarketDataEventModuleConnector market data connector. *

* The factory has the following characteristics. - *

MarketDataManagerModuleFactory Capabilities
CapabilitiesData Requester
Stops data flowsYes
Start OperationNone
+ *
+ * * * * diff --git a/marketdata/marketdata-server/src/test/java/org/marketcetera/marketdata/core/provider/MarketdataCacheElementTest.java b/marketdata/marketdata-server/src/test/java/org/marketcetera/marketdata/core/provider/MarketdataCacheElementTest.java index 2d9e081480..d6aadf3be9 100644 --- a/marketdata/marketdata-server/src/test/java/org/marketcetera/marketdata/core/provider/MarketdataCacheElementTest.java +++ b/marketdata/marketdata-server/src/test/java/org/marketcetera/marketdata/core/provider/MarketdataCacheElementTest.java @@ -18,6 +18,7 @@ import org.marketcetera.event.impl.QuoteEventBuilder; import org.marketcetera.event.impl.TopOfBookEventBuilder; import org.marketcetera.marketdata.Content; +import org.marketcetera.marketdata.MarketDataCacheElement; import org.marketcetera.marketdata.OrderBook; import org.marketcetera.trade.Equity; import org.marketcetera.trade.Instrument; diff --git a/marketdata/marketdata-server/src/test/java/org/marketcetera/marketdata/module/TestFeedModule.java b/marketdata/marketdata-server/src/test/java/org/marketcetera/marketdata/module/TestFeedModule.java index 7ac0313f71..0a7e7d5427 100644 --- a/marketdata/marketdata-server/src/test/java/org/marketcetera/marketdata/module/TestFeedModule.java +++ b/marketdata/marketdata-server/src/test/java/org/marketcetera/marketdata/module/TestFeedModule.java @@ -10,6 +10,7 @@ *

* Module Features *

MarketDataEventModuleConnectorFactory characteristics
Provider URN:metc:mdata:connector
Cardinality:Singleton
Instance URN:metc:mdata:connector:single
+ * * * *
Describes the module characteristics
Factory:{@link TestFeedModuleFactory}
See {@link AbstractMarketDataModule parent} for module features.
diff --git a/marketdata/marketdata-server/src/test/java/org/marketcetera/marketdata/module/TestFeedModuleFactory.java b/marketdata/marketdata-server/src/test/java/org/marketcetera/marketdata/module/TestFeedModuleFactory.java index 5ad68c1100..acc8648b36 100644 --- a/marketdata/marketdata-server/src/test/java/org/marketcetera/marketdata/module/TestFeedModuleFactory.java +++ b/marketdata/marketdata-server/src/test/java/org/marketcetera/marketdata/module/TestFeedModuleFactory.java @@ -12,13 +12,14 @@ *

* The factory has the following characteristics. * + * * * * * * * - * + * *
Describes the module characteristics
Provider URN:metc:mdata:feeder
Cardinality:Singleton
Instance URN:metc:mdata:bogus:feeder
Auto-Instantiated:Yes
Auto-Started:Yes
Instantiation Arguments:None
Module Type:{@link FeederModule}
Module Type:{@link TestFeedModule}
* * @author Colin DuPlantis diff --git a/metrics/metrics-db/.gitignore b/metrics/metrics-db/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/metrics/metrics-db/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/metrics/metrics-db/src/main/java/org/marketcetera/metrics/dao/PersistentMetric.java b/metrics/metrics-db/src/main/java/org/marketcetera/metrics/dao/PersistentMetric.java index 9cfc5eed0f..ece8a4904c 100644 --- a/metrics/metrics-db/src/main/java/org/marketcetera/metrics/dao/PersistentMetric.java +++ b/metrics/metrics-db/src/main/java/org/marketcetera/metrics/dao/PersistentMetric.java @@ -37,7 +37,7 @@ public String getName() /** * Sets the name value. * - * @param a String value + * @param inName a String value */ public void setName(String inName) { @@ -55,7 +55,7 @@ public Date getTimestamp() /** * Sets the timestamp value. * - * @param a Date value + * @param inTimestamp a Date value */ public void setTimestamp(Date inTimestamp) { @@ -73,7 +73,7 @@ public MetricType getType() /** * Sets the type value. * - * @param a MetricType value + * @param inType a MetricType value */ public void setType(MetricType inType) { @@ -91,7 +91,7 @@ public long getCount() /** * Sets the count value. * - * @param a long value + * @param inCount a long value */ public void setCount(long inCount) { @@ -127,7 +127,7 @@ public BigDecimal getMean() /** * Sets the mean value. * - * @param a BigDecimal value + * @param inMean a BigDecimal value */ public void setMean(BigDecimal inMean) { @@ -145,7 +145,7 @@ public BigDecimal getM1() /** * Sets the m1 value. * - * @param a BigDecimal value + * @param inM1 a BigDecimal value */ public void setM1(BigDecimal inM1) { @@ -163,7 +163,7 @@ public BigDecimal getM5() /** * Sets the m5 value. * - * @param a BigDecimal value + * @param inM5 a BigDecimal value */ public void setM5(BigDecimal inM5) { @@ -181,7 +181,7 @@ public BigDecimal getM15() /** * Sets the m15 value. * - * @param a BigDecimal value + * @param inM15 a BigDecimal value */ public void setM15(BigDecimal inM15) { @@ -199,7 +199,7 @@ public BigDecimal getMin() /** * Sets the min value. * - * @param a BigDecimal value + * @param inMin a BigDecimal value */ public void setMin(BigDecimal inMin) { @@ -217,7 +217,7 @@ public BigDecimal getMax() /** * Sets the max value. * - * @param a BigDecimal value + * @param inMax a BigDecimal value */ public void setMax(BigDecimal inMax) { @@ -235,7 +235,7 @@ public BigDecimal getStdDev() /** * Sets the stdDev value. * - * @param a BigDecimal value + * @param inStdDev a BigDecimal value */ public void setStdDev(BigDecimal inStdDev) { @@ -253,7 +253,7 @@ public BigDecimal getMedian() /** * Sets the median value. * - * @param a BigDecimal value + * @param inMedian a BigDecimal value */ public void setMedian(BigDecimal inMedian) { @@ -271,7 +271,7 @@ public BigDecimal getP75() /** * Sets the p75 value. * - * @param a BigDecimal value + * @param inP75 a BigDecimal value */ public void setP75(BigDecimal inP75) { @@ -289,7 +289,7 @@ public BigDecimal getP95() /** * Sets the p95 value. * - * @param a BigDecimal value + * @param inP95 a BigDecimal value */ public void setP95(BigDecimal inP95) { @@ -307,7 +307,7 @@ public BigDecimal getP98() /** * Sets the p98 value. * - * @param a BigDecimal value + * @param inP98 a BigDecimal value */ public void setP98(BigDecimal inP98) { @@ -325,7 +325,7 @@ public BigDecimal getP99() /** * Sets the p99 value. * - * @param a BigDecimal value + * @param inP99 a BigDecimal value */ public void setP99(BigDecimal inP99) { @@ -343,7 +343,7 @@ public BigDecimal getP999() /** * Sets the p999 value. * - * @param a BigDecimal value + * @param inP999 a BigDecimal value */ public void setP999(BigDecimal inP999) { @@ -361,7 +361,7 @@ public BigDecimal getMeanRate() /** * Sets the meanRate value. * - * @param a BigDecimal value + * @param inMeanRate a BigDecimal value */ public void setMeanRate(BigDecimal inMeanRate) { @@ -379,7 +379,7 @@ public String getRateUnit() /** * Sets the rateUnit value. * - * @param a String value + * @param inRateUnit a String value */ public void setRateUnit(String inRateUnit) { @@ -397,7 +397,7 @@ public String getDurationUnit() /** * Sets the durationUnit value. * - * @param a String value + * @param inDurationUnit a String value */ public void setDurationUnit(String inDurationUnit) { @@ -415,7 +415,7 @@ public int getHour() /** * Sets the hour value. * - * @param an int value + * @param inHour an int value */ public void setHour(int inHour) { @@ -433,7 +433,7 @@ public int getMinute() /** * Sets the minute value. * - * @param an int value + * @param inMinute an int value */ public void setMinute(int inMinute) { @@ -451,7 +451,7 @@ public int getSecond() /** * Sets the second value. * - * @param an int value + * @param inSecond an int value */ public void setSecond(int inSecond) { @@ -469,7 +469,7 @@ public int getMillis() /** * Sets the millis value. * - * @param an int value + * @param inMillis an int value */ public void setMillis(int inMillis) { diff --git a/metrics/metrics-log/.gitignore b/metrics/metrics-log/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/metrics/metrics-log/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/modules/cep/esper/.gitignore b/modules/cep/esper/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/modules/cep/esper/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/modules/cep/esper/src/main/java/org/marketcetera/modules/cep/esper/CEPEsperFactory.java b/modules/cep/esper/src/main/java/org/marketcetera/modules/cep/esper/CEPEsperFactory.java index 909ba7ee21..fa90dab9e2 100644 --- a/modules/cep/esper/src/main/java/org/marketcetera/modules/cep/esper/CEPEsperFactory.java +++ b/modules/cep/esper/src/main/java/org/marketcetera/modules/cep/esper/CEPEsperFactory.java @@ -15,7 +15,8 @@ * request and they are auto-started. *

* The factory has the following characteristics. - * + *
+ * * * * diff --git a/modules/cep/esper/src/main/java/org/marketcetera/modules/cep/esper/CEPEsperProcessor.java b/modules/cep/esper/src/main/java/org/marketcetera/modules/cep/esper/CEPEsperProcessor.java index 52c9837dd3..ae313a33db 100644 --- a/modules/cep/esper/src/main/java/org/marketcetera/modules/cep/esper/CEPEsperProcessor.java +++ b/modules/cep/esper/src/main/java/org/marketcetera/modules/cep/esper/CEPEsperProcessor.java @@ -48,7 +48,8 @@ * reported and ignored. *

* Module Features - *

CEPEsperFactory characteristics
Provider URN:metc:cep:esper
Cardinality:Multi-Instance
Auto-Instantiated:Yes
+ *
+ * * * * diff --git a/modules/cep/esper/src/test/java/org/marketcetera/modules/cep/esper/EsperModuleTest.java b/modules/cep/esper/src/test/java/org/marketcetera/modules/cep/esper/EsperModuleTest.java index faa9151d1d..e4cbef493d 100644 --- a/modules/cep/esper/src/test/java/org/marketcetera/modules/cep/esper/EsperModuleTest.java +++ b/modules/cep/esper/src/test/java/org/marketcetera/modules/cep/esper/EsperModuleTest.java @@ -58,7 +58,7 @@ protected Class getIncorrectQueryException() { /** * We have the following data flow: - * CopierModule --> CEP --> Sink + * CopierModule --> CEP --> Sink * Feed 3 events into copier (which just re-emits it), and then test that it goes through to the Sink via Esper * * @throws Exception if there were unexpected errors. diff --git a/modules/cep/system/.gitignore b/modules/cep/system/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/modules/cep/system/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/modules/cep/system/src/main/java/org/marketcetera/modules/cep/system/CEPSystemFactory.java b/modules/cep/system/src/main/java/org/marketcetera/modules/cep/system/CEPSystemFactory.java index 0259a402bc..c28e5761c6 100644 --- a/modules/cep/system/src/main/java/org/marketcetera/modules/cep/system/CEPSystemFactory.java +++ b/modules/cep/system/src/main/java/org/marketcetera/modules/cep/system/CEPSystemFactory.java @@ -10,7 +10,8 @@ * See {@link CEPSystemProcessor} for an explanation of how the System CEP module works. *

* The factory has the following characteristics. - *

CEPEsperProcessor capabilities
CapabilitiesData Emitter, Data Receiver
DataFlow Request ParametersString: CEP query; String[]: Multiple CEP queries
Stops data flowsIf it encounters an error when creating statements in external time mode.
+ *
+ * * * * diff --git a/modules/cep/system/src/main/java/org/marketcetera/modules/cep/system/CEPSystemProcessor.java b/modules/cep/system/src/main/java/org/marketcetera/modules/cep/system/CEPSystemProcessor.java index 18e8894252..e4dd7d7e25 100644 --- a/modules/cep/system/src/main/java/org/marketcetera/modules/cep/system/CEPSystemProcessor.java +++ b/modules/cep/system/src/main/java/org/marketcetera/modules/cep/system/CEPSystemProcessor.java @@ -16,7 +16,8 @@ * *

* Module Features - *

CEPSystemFactory Characteristics
Provider URN:metc:cep:system
Cardinality:Multi-Instance
Auto-Instantiated:Yes
+ *
+ * * * * diff --git a/modules/machine-learning/tensorflow/.gitignore b/modules/machine-learning/tensorflow/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/modules/machine-learning/tensorflow/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/modules/machine-learning/tensorflow/src/main/java/org/marketcetera/tensorflow/converter/TensorFlowConverterModule.java b/modules/machine-learning/tensorflow/src/main/java/org/marketcetera/tensorflow/converter/TensorFlowConverterModule.java index a5d0d5d690..77c67a350d 100644 --- a/modules/machine-learning/tensorflow/src/main/java/org/marketcetera/tensorflow/converter/TensorFlowConverterModule.java +++ b/modules/machine-learning/tensorflow/src/main/java/org/marketcetera/tensorflow/converter/TensorFlowConverterModule.java @@ -29,7 +29,8 @@ * Converts conventional data types to {@link Tensor} objects. * *

Module Features

- *
CEPSystemProcessor Capabilities
CapabilitiesData Emitter, Data Receiver
DataFlow Request ParametersString: The CEP query
Stops data flowsNo
+ *
+ * * * * diff --git a/modules/machine-learning/tensorflow/src/main/java/org/marketcetera/tensorflow/converter/TensorFlowConverterModuleFactory.java b/modules/machine-learning/tensorflow/src/main/java/org/marketcetera/tensorflow/converter/TensorFlowConverterModuleFactory.java index a0ac023655..622eea0c2b 100644 --- a/modules/machine-learning/tensorflow/src/main/java/org/marketcetera/tensorflow/converter/TensorFlowConverterModuleFactory.java +++ b/modules/machine-learning/tensorflow/src/main/java/org/marketcetera/tensorflow/converter/TensorFlowConverterModuleFactory.java @@ -13,7 +13,8 @@ * Provider that will convert incoming data flow data to {@link Tensor} types. * *

The factory has the following characteristics.

- *
TensorFlowConverterModule capabilities
CapabilitiesData Emitter, Data Receiver
DataFlow Request Parametersnone
Stops data flowsn/a
+ *
+ * * * * diff --git a/modules/machine-learning/tensorflow/src/main/java/org/marketcetera/tensorflow/model/TensorFlowModelModuleFactory.java b/modules/machine-learning/tensorflow/src/main/java/org/marketcetera/tensorflow/model/TensorFlowModelModuleFactory.java index ebe01c9567..8fa5030058 100644 --- a/modules/machine-learning/tensorflow/src/main/java/org/marketcetera/tensorflow/model/TensorFlowModelModuleFactory.java +++ b/modules/machine-learning/tensorflow/src/main/java/org/marketcetera/tensorflow/model/TensorFlowModelModuleFactory.java @@ -12,7 +12,8 @@ * Provides a module that invokes an existing TensorFlow model. * *

The factory has the following characteristics.

- *
TensorFlowConverterModuleFactory characteristics
Provider URN:metc:tensorflow:converter
Cardinality:Single Instance
Auto-Instantiated:Yes
+ *
+ * * * * diff --git a/modules/marketdata/bogus/.gitignore b/modules/marketdata/bogus/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/modules/marketdata/bogus/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/modules/marketdata/bogus/src/main/java/org/marketcetera/marketdata/bogus/BogusFeedModule.java b/modules/marketdata/bogus/src/main/java/org/marketcetera/marketdata/bogus/BogusFeedModule.java index 3d9082253d..43310b002d 100644 --- a/modules/marketdata/bogus/src/main/java/org/marketcetera/marketdata/bogus/BogusFeedModule.java +++ b/modules/marketdata/bogus/src/main/java/org/marketcetera/marketdata/bogus/BogusFeedModule.java @@ -17,7 +17,8 @@ * Module for {@link BogusFeed}. *

* Module Features - *

TensorFlowModelModuleFactory characteristics
Provider URN:metc:tensorflow:model
Cardinality:Single Instance
Auto-Instantiated:Yes
+ *
+ * * * *
Describes the module attributes
Factory:{@link BogusFeedModuleFactory}
See {@link AbstractMarketDataModule parent} for module features.
diff --git a/modules/marketdata/bogus/src/main/java/org/marketcetera/marketdata/bogus/BogusFeedModuleFactory.java b/modules/marketdata/bogus/src/main/java/org/marketcetera/marketdata/bogus/BogusFeedModuleFactory.java index b446e2d42a..9d5c9b708c 100644 --- a/modules/marketdata/bogus/src/main/java/org/marketcetera/marketdata/bogus/BogusFeedModuleFactory.java +++ b/modules/marketdata/bogus/src/main/java/org/marketcetera/marketdata/bogus/BogusFeedModuleFactory.java @@ -21,7 +21,8 @@ * ModuleFactory implementation for the BogusFeed market data provider. *

* The factory has the following characteristics. - * + *
+ * * * * diff --git a/modules/marketdata/csv/.gitignore b/modules/marketdata/csv/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/modules/marketdata/csv/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/modules/marketdata/csv/src/main/java/org/marketcetera/marketdata/csv/BasicCSVFeedEventTranslator.java b/modules/marketdata/csv/src/main/java/org/marketcetera/marketdata/csv/BasicCSVFeedEventTranslator.java index 3092093dec..f269f69125 100644 --- a/modules/marketdata/csv/src/main/java/org/marketcetera/marketdata/csv/BasicCSVFeedEventTranslator.java +++ b/modules/marketdata/csv/src/main/java/org/marketcetera/marketdata/csv/BasicCSVFeedEventTranslator.java @@ -73,7 +73,8 @@ * more detailed behavior. * *

The default implementation expects data in the following format: - *

Describes the module attributes
Provider URN:metc:mdata:bogus
Cardinality:Singleton
Instance URN:metc:mdata:bogus:single
+ *
+ * * * * diff --git a/modules/marketdata/marketdata-exsim/.gitignore b/modules/marketdata/marketdata-exsim/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/modules/marketdata/marketdata-exsim/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/modules/marketdata/marketdata-exsim/src/main/java/org/marketcetera/marketdata/exsim/ExsimFeedModuleFactory.java b/modules/marketdata/marketdata-exsim/src/main/java/org/marketcetera/marketdata/exsim/ExsimFeedModuleFactory.java index 2c51d5d764..1620f1f442 100644 --- a/modules/marketdata/marketdata-exsim/src/main/java/org/marketcetera/marketdata/exsim/ExsimFeedModuleFactory.java +++ b/modules/marketdata/marketdata-exsim/src/main/java/org/marketcetera/marketdata/exsim/ExsimFeedModuleFactory.java @@ -18,7 +18,8 @@ * ModuleFactory implementation for the ExsimFeed market data provider. *

* The factory has the following characteristics. - *

BasicCSVFeedEventTranslator data format
Column0BIDASKTRADEDIVIDENDSTAT
Column1TimestampTimestampTimestampTimestampTimestamp
Column2SymbolSymbolSymbolEquity SymbolSymbol
+ *
+ * * * * diff --git a/modules/marketdata/marketdata-manual/.gitignore b/modules/marketdata/marketdata-manual/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/modules/marketdata/marketdata-manual/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/modules/marketdata/marketdata-manual/src/main/java/org/marketcetera/marketdata/manual/ManualFeedModuleFactory.java b/modules/marketdata/marketdata-manual/src/main/java/org/marketcetera/marketdata/manual/ManualFeedModuleFactory.java index 9de2565443..a03b77831b 100644 --- a/modules/marketdata/marketdata-manual/src/main/java/org/marketcetera/marketdata/manual/ManualFeedModuleFactory.java +++ b/modules/marketdata/marketdata-manual/src/main/java/org/marketcetera/marketdata/manual/ManualFeedModuleFactory.java @@ -18,6 +18,7 @@ *

* The factory has the following characteristics. *

ExsimFeedModuleFactory characteristics
Provider URN:metc:mdata:exsim
Cardinality:Singleton
Instance URN:metc:mdata:exsim:single
+ * * * * diff --git a/modules/marketdata/marketdata-recorder/.gitignore b/modules/marketdata/marketdata-recorder/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/modules/marketdata/marketdata-recorder/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/modules/marketdata/marketdata-recorder/src/main/java/org/marketcetera/marketdata/recorder/MarketDataRecorderModule.java b/modules/marketdata/marketdata-recorder/src/main/java/org/marketcetera/marketdata/recorder/MarketDataRecorderModule.java index 2256ad70d6..49fbba386c 100644 --- a/modules/marketdata/marketdata-recorder/src/main/java/org/marketcetera/marketdata/recorder/MarketDataRecorderModule.java +++ b/modules/marketdata/marketdata-recorder/src/main/java/org/marketcetera/marketdata/recorder/MarketDataRecorderModule.java @@ -55,7 +55,8 @@ * Provides an implementation that writes market data to files in a given directory. *

* Module Features - *

Manual Feed Module Capabilities
Provider URN:metc:mdata:manual
Cardinality:Singleton
Instance URN:metc:mdata:manual:single
+ *
+ * * * * diff --git a/modules/marketdata/marketdata-recorder/src/main/java/org/marketcetera/marketdata/recorder/MarketDataRecorderModuleFactory.java b/modules/marketdata/marketdata-recorder/src/main/java/org/marketcetera/marketdata/recorder/MarketDataRecorderModuleFactory.java index bd064b267d..70a66b96e0 100644 --- a/modules/marketdata/marketdata-recorder/src/main/java/org/marketcetera/marketdata/recorder/MarketDataRecorderModuleFactory.java +++ b/modules/marketdata/marketdata-recorder/src/main/java/org/marketcetera/marketdata/recorder/MarketDataRecorderModuleFactory.java @@ -16,7 +16,8 @@ * *

* The factory has the following characteristics. - *

MarketDataRecorderModule featues
CapabilitiesData Receiver,Data Emitter
Stops data flowsNo
Start OperationChecks that the directory exists and is writable
+ *
+ * * * * diff --git a/modules/marketdata/yahoo/.gitignore b/modules/marketdata/yahoo/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/modules/marketdata/yahoo/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/modules/marketdata/yahoo/src/main/java/org/marketcetera/marketdata/yahoo/YahooFeedModule.java b/modules/marketdata/yahoo/src/main/java/org/marketcetera/marketdata/yahoo/YahooFeedModule.java index 126d671dae..b272acfcf8 100644 --- a/modules/marketdata/yahoo/src/main/java/org/marketcetera/marketdata/yahoo/YahooFeedModule.java +++ b/modules/marketdata/yahoo/src/main/java/org/marketcetera/marketdata/yahoo/YahooFeedModule.java @@ -16,7 +16,8 @@ * *

* Module Features - *

MarketDataRecorderModuleFactory characteristics
Provider URN:metc:mdata:recorder
Cardinality:Multi-Instance
Auto-Instantiated:No
+ *
+ * * * * diff --git a/modules/misc/.gitignore b/modules/misc/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/modules/misc/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/modules/misc/src/main/java/org/marketcetera/modules/async/SimpleAsyncProcessor.java b/modules/misc/src/main/java/org/marketcetera/modules/async/SimpleAsyncProcessor.java index 67fd7bed80..7c05a68857 100644 --- a/modules/misc/src/main/java/org/marketcetera/modules/async/SimpleAsyncProcessor.java +++ b/modules/misc/src/main/java/org/marketcetera/modules/async/SimpleAsyncProcessor.java @@ -98,7 +98,8 @@ * while the sink module processes the event (for example, logs it). *

* Module Features - *

YahooFeedModule capabilities
CapabilitiesData Emitter
Stops data flowsNo
Start OperationStarts the feed, logs into it.
+ *
+ * * * * diff --git a/modules/misc/src/main/java/org/marketcetera/modules/async/SimpleAsyncProcessorFactory.java b/modules/misc/src/main/java/org/marketcetera/modules/async/SimpleAsyncProcessorFactory.java index 09efaad7f8..1cce1f9c6a 100644 --- a/modules/misc/src/main/java/org/marketcetera/modules/async/SimpleAsyncProcessorFactory.java +++ b/modules/misc/src/main/java/org/marketcetera/modules/async/SimpleAsyncProcessorFactory.java @@ -11,7 +11,8 @@ * is different from the thread on which the data is received.. *

* The factory has the following characteristics. - *

Describes the module attributes
CapabilitiesData Emitter, Data Reciever
DataFlow Request ParametersNone.
Stops data flowsNo.
+ *
+ * * * * diff --git a/modules/misc/src/main/java/org/marketcetera/modules/csv/CSVEmitter.java b/modules/misc/src/main/java/org/marketcetera/modules/csv/CSVEmitter.java index 463f7d8b20..14f2aa137e 100644 --- a/modules/misc/src/main/java/org/marketcetera/modules/csv/CSVEmitter.java +++ b/modules/misc/src/main/java/org/marketcetera/modules/csv/CSVEmitter.java @@ -51,7 +51,8 @@ * *

* Module Features - *

Describes the module attributes
Provider URN:metc:async:simple
Cardinality:Multi-Instance
Auto-Instantiated:Yes
+ *
+ * * * * diff --git a/modules/misc/src/main/java/org/marketcetera/modules/csv/CSVEmitterFactory.java b/modules/misc/src/main/java/org/marketcetera/modules/csv/CSVEmitterFactory.java index 26498fc4c4..2ee02f9e32 100644 --- a/modules/misc/src/main/java/org/marketcetera/modules/csv/CSVEmitterFactory.java +++ b/modules/misc/src/main/java/org/marketcetera/modules/csv/CSVEmitterFactory.java @@ -10,7 +10,8 @@ * Provider that will emit data contained in CSV as a series of maps. *

* The factory has the following characteristics. - *

Describes the module attributes
CapabilitiesData Emitter
DataFlow Request ParametersString, File or URL. Usage explained above.
Stops data flowsYes, if there's no more data to emit or if there was an error reading data from the file/URL.
+ *
+ * * * * diff --git a/modules/misc/src/main/java/org/marketcetera/modules/headwater/HeadwaterModule.java b/modules/misc/src/main/java/org/marketcetera/modules/headwater/HeadwaterModule.java index 4141c65d26..08dd0d6406 100644 --- a/modules/misc/src/main/java/org/marketcetera/modules/headwater/HeadwaterModule.java +++ b/modules/misc/src/main/java/org/marketcetera/modules/headwater/HeadwaterModule.java @@ -23,17 +23,17 @@ /** * Provides an insertion point to a module framework data flow. * - *

Module Features + *

Module Features

*
Describes the module attributes
Provider URN:metc:csv:system
Cardinality:Singleton
InstanceURN:metc:csv:system:single
+ * * * * * * - * n/a + * * *
Headwater Module Attributes
CapabilitiesData Emitter
DataFlow Request Parametersnone
Stops data flowsn/a
Start Operationn/a
Stop Operationn/a
Management Interface
Management Interfacen/a
Factory{@link HeadwaterModuleFactory}
- *

* * @author Colin DuPlantis * @version $Id$ diff --git a/modules/misc/src/main/java/org/marketcetera/modules/headwater/HeadwaterModuleFactory.java b/modules/misc/src/main/java/org/marketcetera/modules/headwater/HeadwaterModuleFactory.java index 6265c35e79..bbba1dc673 100644 --- a/modules/misc/src/main/java/org/marketcetera/modules/headwater/HeadwaterModuleFactory.java +++ b/modules/misc/src/main/java/org/marketcetera/modules/headwater/HeadwaterModuleFactory.java @@ -11,7 +11,8 @@ * Creates {@link HeadwaterModule} objects. * *

The factory has the following characteristics. - * + *
+ * * * * diff --git a/modules/misc/src/main/java/org/marketcetera/modules/publisher/PublisherModule.java b/modules/misc/src/main/java/org/marketcetera/modules/publisher/PublisherModule.java index cdae54467a..a15a0810d7 100644 --- a/modules/misc/src/main/java/org/marketcetera/modules/publisher/PublisherModule.java +++ b/modules/misc/src/main/java/org/marketcetera/modules/publisher/PublisherModule.java @@ -13,7 +13,8 @@ * Publishes received data to a given publisher before optionally passing it on in the flow. * *

Module Features - *

Headerwater Module Attributes
Provider URN:metc:misc:headwater
Cardinality:Multi-Instance
Auto-Instantiated:No
+ *
+ * * * * diff --git a/packages/dare-package/.gitignore b/packages/dare-package/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/packages/dare-package/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/packages/dare-package/src/main/java/org/marketcetera/server/DareApplication.java b/packages/dare-package/src/main/java/org/marketcetera/server/DareApplication.java index cfcdc341f6..387f7a0b96 100644 --- a/packages/dare-package/src/main/java/org/marketcetera/server/DareApplication.java +++ b/packages/dare-package/src/main/java/org/marketcetera/server/DareApplication.java @@ -23,7 +23,6 @@ import org.marketcetera.admin.user.PersistentUserFactory; import org.marketcetera.brokers.BrokerSelector; import org.marketcetera.brokers.service.FixSessionProvider; -import org.marketcetera.client.rpc.server.TradeRpcService; import org.marketcetera.cluster.ClusterDataFactory; import org.marketcetera.cluster.SimpleClusterDataFactory; import org.marketcetera.cluster.rpc.ClusterRpcService; @@ -59,12 +58,14 @@ import org.marketcetera.trade.AverageFillPriceFactory; import org.marketcetera.trade.BasicSelector; import org.marketcetera.trade.SimpleAverageFillPriceFactory; +import org.marketcetera.trade.client.DirectTradeClient; import org.marketcetera.trade.event.connector.IncomingTradeMessageBroadcastConnector; import org.marketcetera.trade.event.connector.IncomingTradeMessageConverterConnector; import org.marketcetera.trade.event.connector.IncomingTradeMessagePersistenceConnector; import org.marketcetera.trade.event.connector.OrderConverterConnector; import org.marketcetera.trade.event.connector.OutgoingMessageCachingConnector; import org.marketcetera.trade.event.connector.OutgoingMessagePersistenceConnector; +import org.marketcetera.trade.rpc.server.TradeRpcService; import org.marketcetera.trade.service.MessageOwnerService; import org.marketcetera.trade.service.impl.MessageOwnerServiceImpl; import org.marketcetera.util.log.SLF4JLoggerProxy; @@ -197,6 +198,16 @@ public DirectMarketDataClient getMarketDataClient() { return new DirectMarketDataClient(); } + /** + * Get the trade client value. + * + * @return a DirectTradeClient value + */ + @Bean + public DirectTradeClient getTradeClient() + { + return new DirectTradeClient(); + } /** * Get the strategy message factory value. * diff --git a/packages/dare-package/src/main/resources/db/migration/psql/V114__strategy.sql b/packages/dare-package/src/main/resources/db/migration/psql/V114__strategy.sql index b91c012d2e..94e4374e34 100644 --- a/packages/dare-package/src/main/resources/db/migration/psql/V114__strategy.sql +++ b/packages/dare-package/src/main/resources/db/migration/psql/V114__strategy.sql @@ -38,11 +38,12 @@ insert into metc_permissions values(((select max(id) from metc_permissions)+1),n insert into metc_permissions values(((select max(id) from metc_permissions)+1),now(),0,'Remove events generated by strategies','ClearStrategyEventsAction'); insert into metc_permissions values(((select max(id) from metc_permissions)+1),now(),0,'Access to cancel strategies being uploaded','CancelStrategyUploadAction'); insert into metc_permissions values(((select max(id) from metc_permissions)+1),now(),0,'Access to read strategy messages','ReadStrategyMessagesAction'); -insert into metc_permissions values(((select max(id) from metc_permissions)+1),now(),0,'Access to rcreate strategy messages','CreateStrategyMessagesAction'); +insert into metc_permissions values(((select max(id) from metc_permissions)+1),now(),0,'Access to create strategy messages','CreateStrategyMessagesAction'); +insert into metc_permissions values(((select max(id) from metc_permissions)+1),now(),0,'Access to delete strategy messages','DeleteStrategyMessagesAction'); insert into metc_roles_permissions select a.id as roles_id,b.id as permissions_id from metc_roles a,metc_permissions b where b.name like '%Strategy%Action' and (a.name='Trader' or a.name='TraderAdmin'); -- --- Name: metc_strategy_messages; Type: TABLE; Schema: public; Owner: metc +-- Name: metc_strategy_messages; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE metc_strategy_messages ( @@ -51,12 +52,14 @@ CREATE TABLE metc_strategy_messages ( update_count integer NOT NULL, message character varying(255), message_timestamp timestamp without time zone, - severity integer, + severity character varying(255), + strategy_message_id bigint NOT NULL, strategy_instance_id bigint ); + -- --- Name: metc_strategy_messages metc_strategy_messages_pkey; Type: CONSTRAINT; Schema: public; Owner: metc +-- Name: metc_strategy_messages metc_strategy_messages_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY metc_strategy_messages @@ -64,8 +67,17 @@ ALTER TABLE ONLY metc_strategy_messages -- --- Name: metc_strategy_messages fk66jhynr1a7r5x55l5c0x0hasx; Type: FK CONSTRAINT; Schema: public; Owner: metc +-- Name: metc_strategy_messages uk_ehwshs455mw0dcui1x6ra8a3y; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY metc_strategy_messages + ADD CONSTRAINT uk_ehwshs455mw0dcui1x6ra8a3y UNIQUE (strategy_message_id); + + +-- +-- Name: metc_strategy_messages fk66jhynr1a7r5x55l5c0x0hasx; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY metc_strategy_messages ADD CONSTRAINT fk66jhynr1a7r5x55l5c0x0hasx FOREIGN KEY (strategy_instance_id) REFERENCES metc_strategy_instances(id); + diff --git a/packages/dare-package/src/main/resources/db/migration/psql/V115__suggestion_permissions.sql b/packages/dare-package/src/main/resources/db/migration/psql/V115__suggestion_permissions.sql new file mode 100644 index 0000000000..f03691cd96 --- /dev/null +++ b/packages/dare-package/src/main/resources/db/migration/psql/V115__suggestion_permissions.sql @@ -0,0 +1,3 @@ +insert into metc_permissions values(((select max(id) from metc_permissions)+1),now(),0,'Access to read ltrade suggestions','ViewSuggestionsAction'); +insert into metc_permissions values(((select max(id) from metc_permissions)+1),now(),0,'Access to create ltrade suggestions','SendSuggestionAction'); +insert into metc_roles_permissions select a.id as roles_id,b.id as permissions_id from metc_roles a,metc_permissions b where b.name like '%Suggestion%Action' and (a.name='Trader' or a.name='TraderAdmin'); diff --git a/packages/dare-package/src/test/cmd_exec/conf/application.properties b/packages/dare-package/src/test/cmd_exec/conf/application.properties index 513dcedaed..05ab13935d 100644 --- a/packages/dare-package/src/test/cmd_exec/conf/application.properties +++ b/packages/dare-package/src/test/cmd_exec/conf/application.properties @@ -14,6 +14,7 @@ spring.flyway.enabled=true metc.ws.hostname=0.0.0.0 # interval in seconds at which to record metrics metc.metric.service.log.reporter.interval=10 +# list of classes that can be marshaled to and from XML metc.xml.context.path.classes=org.marketcetera.trade.Equity,org.marketcetera.trade.Future # determines how long to delay evaluation of work units metc.cluster.work.unit.evaluation.delay=1000 diff --git a/packages/docker-package/.gitignore b/packages/docker-package/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/packages/docker-package/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/photon/.gitignore b/photon/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/photon/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/photon/src/main/java/org/marketcetera/ui/DragResizer.java b/photon/src/main/java/org/marketcetera/ui/DragResizer.java deleted file mode 100644 index 29191c7ddd..0000000000 --- a/photon/src/main/java/org/marketcetera/ui/DragResizer.java +++ /dev/null @@ -1,115 +0,0 @@ -package org.marketcetera.ui; - - -import javafx.event.EventHandler; -import javafx.scene.Cursor; -import javafx.scene.input.MouseEvent; -import javafx.scene.layout.Region; - -/** - * {@link DragResizer} can be used to add mouse listeners to a {@link Region} - * and make it resizable by the user by clicking and dragging the border in the - * same way as a window. - *

- * Only height resizing is currently implemented. Usage:

DragResizer.makeResizable(myAnchorPane);
- * - * @author atill - * - */ -public class DragResizer { - - /** - * The margin around the control that a user can click in to start resizing - * the region. - */ - private static final int RESIZE_MARGIN = 5; - - private final Region region; - - private double y; - - private boolean initMinHeight; - - private boolean dragging; - - private DragResizer(Region aRegion) { - region = aRegion; - } - - public static void makeResizable(Region region) { - final DragResizer resizer = new DragResizer(region); - - region.setOnMousePressed(new EventHandler() { - @Override - public void handle(MouseEvent event) { - resizer.mousePressed(event); - }}); - region.setOnMouseDragged(new EventHandler() { - @Override - public void handle(MouseEvent event) { - resizer.mouseDragged(event); - }}); - region.setOnMouseMoved(new EventHandler() { - @Override - public void handle(MouseEvent event) { - resizer.mouseOver(event); - }}); - region.setOnMouseReleased(new EventHandler() { - @Override - public void handle(MouseEvent event) { - resizer.mouseReleased(event); - }}); - } - - protected void mouseReleased(MouseEvent event) { - dragging = false; - region.setCursor(Cursor.DEFAULT); - } - - protected void mouseOver(MouseEvent event) { - if(isInDraggableZone(event) || dragging) { - region.setCursor(Cursor.S_RESIZE); - } - else { - region.setCursor(Cursor.DEFAULT); - } - } - - protected boolean isInDraggableZone(MouseEvent event) { - return event.getY() > (region.getHeight() - RESIZE_MARGIN); - } - - protected void mouseDragged(MouseEvent event) { - if(!dragging) { - return; - } - - double mousey = event.getY(); - - double newHeight = region.getMinHeight() + (mousey - y); - - region.setMinHeight(newHeight); - - y = mousey; - } - - protected void mousePressed(MouseEvent event) { - - // ignore clicks outside of the draggable margin - if(!isInDraggableZone(event)) { - return; - } - - dragging = true; - - // make sure that the minimum height is set to the current height once, - // setting a min height that is smaller than the current height will - // have no effect - if (!initMinHeight) { - region.setMinHeight(region.getHeight()); - initMinHeight = true; - } - - y = event.getY(); - } -} diff --git a/photon/src/main/java/org/marketcetera/ui/Draggable.java b/photon/src/main/java/org/marketcetera/ui/Draggable.java deleted file mode 100644 index a44d673e0a..0000000000 --- a/photon/src/main/java/org/marketcetera/ui/Draggable.java +++ /dev/null @@ -1,152 +0,0 @@ -package org.marketcetera.ui; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javafx.event.EventHandler; -import javafx.scene.Node; -import javafx.scene.input.MouseEvent; - -/** - * Generalised implementation of 'Draggability' of a {@link Node}. The Draggable class is used as a 'namespace' for the internal - * class/interfaces/enum. - * @author phill - * - */ -public class Draggable { - public enum Event { - None, DragStart, Drag, DragEnd - } - - /** - * Marker for an entity that has draggable nature. - * @author phill - */ - public interface Interface { - public abstract Draggable.Nature getDraggableNature(); - } - - public interface Listener { - public void accept(Nature draggableNature, Event dragEvent); - } - - /** - * Class that encapsulates the draggable nature of a node. - *
    - *
  • EventNode: the event that receives the drag events
  • - *
  • One or more DragNodes: that move in response to the drag events. The EventNode is usually (but not always) a - * DragNode
  • - *
  • Listeners: listen for the drag events
  • - *
- * @author phill - * - */ - public static final class Nature implements EventHandler { - private double lastMouseX = 0, lastMouseY = 0; // scene coords - - private boolean dragging = false; - - private final boolean enabled = true; - private final Node eventNode; - private final List dragNodes = new ArrayList<>(); - private final List dragListeners = new ArrayList<>(); - - public Nature(final Node node) { - this(node, node); - } - - public Nature(final Node eventNode, final Node... dragNodes) { - this.eventNode = eventNode; - this.dragNodes.addAll(Arrays.asList(dragNodes)); - this.eventNode.addEventHandler(MouseEvent.ANY, this); - } - - public final boolean addDraggedNode(final Node node) { - if (!this.dragNodes.contains(node)) { - return this.dragNodes.add(node); - } - return false; - } - - public final boolean addListener(final Listener listener) { - return this.dragListeners.add(listener); - } - - public final void detatch() { - this.eventNode.removeEventFilter(MouseEvent.ANY, this); - } - - public final List getDragNodes() { - return new ArrayList<>(this.dragNodes); - } - - public final Node getEventNode() { - return this.eventNode; - } - - @Override - public final void handle(final MouseEvent event) { - if (MouseEvent.MOUSE_PRESSED == event.getEventType()) { - if (this.enabled && this.eventNode.contains(event.getX(), event.getY())) { - this.lastMouseX = event.getSceneX(); - this.lastMouseY = event.getSceneY(); - event.consume(); - } - } else if (MouseEvent.MOUSE_DRAGGED == event.getEventType()) { - if (!this.dragging) { - this.dragging = true; - for (final Listener listener : this.dragListeners) { - listener.accept(this, Draggable.Event.DragStart); - } - } - if (this.dragging) { - final double deltaX = event.getSceneX() - this.lastMouseX; - final double deltaY = event.getSceneY() - this.lastMouseY; - - for (final Node dragNode : this.dragNodes) { - final double initialTranslateX = dragNode.getTranslateX(); - final double initialTranslateY = dragNode.getTranslateY(); - dragNode.setTranslateX(initialTranslateX + deltaX); - dragNode.setTranslateY(initialTranslateY + deltaY); - } - - this.lastMouseX = event.getSceneX(); - this.lastMouseY = event.getSceneY(); - - event.consume(); - for (final Listener listener : this.dragListeners) { - listener.accept(this, Draggable.Event.Drag); - } - } - } else if (MouseEvent.MOUSE_RELEASED == event.getEventType()) { - if (this.dragging) { - event.consume(); - this.dragging = false; - for (final Listener listener : this.dragListeners) { - listener.accept(this, Draggable.Event.DragEnd); - } - } - } - - } - - public final boolean removeDraggedNode(final Node node) { - return this.dragNodes.remove(node); - } - - public final boolean removeListener(final Listener listener) { - return this.dragListeners.remove(listener); - } - - /** - * When the initial mousePressed is missing we can supply the first coordinates programmatically. - * @param lastMouseX - * @param lastMouseY - */ - public final void setLastMouse(final double lastMouseX, final double lastMouseY) { - this.lastMouseX = lastMouseX; - this.lastMouseY = lastMouseY; - } - } -} diff --git a/photon/src/main/java/org/marketcetera/ui/LoginView.java b/photon/src/main/java/org/marketcetera/ui/LoginView.java index 07c3017dde..dd8fbb5fd5 100644 --- a/photon/src/main/java/org/marketcetera/ui/LoginView.java +++ b/photon/src/main/java/org/marketcetera/ui/LoginView.java @@ -16,7 +16,6 @@ import org.springframework.stereotype.Component; import io.grpc.StatusRuntimeException; -import javafx.application.Platform; import javafx.beans.value.ChangeListener; import javafx.event.ActionEvent; import javafx.geometry.Insets; @@ -171,8 +170,7 @@ private void onLogin(ActionEvent inEvent) */ private void onCloseRequest(WindowEvent inEvent) { - // shutdown the whole app - Platform.exit(); + PhotonApp.getApp().doAppShutdown(); } /** * main scene of the dialog diff --git a/photon/src/main/java/org/marketcetera/ui/PhotonApp.java b/photon/src/main/java/org/marketcetera/ui/PhotonApp.java index 8ce11caffb..3d126d020a 100644 --- a/photon/src/main/java/org/marketcetera/ui/PhotonApp.java +++ b/photon/src/main/java/org/marketcetera/ui/PhotonApp.java @@ -3,12 +3,9 @@ import java.awt.Taskbar; import java.awt.Taskbar.Feature; import java.awt.Toolkit; -import java.io.IOException; -import java.util.Properties; import org.marketcetera.ui.events.LoginEvent; import org.marketcetera.ui.events.LogoutEvent; -import org.marketcetera.ui.service.DisplayLayoutService; import org.marketcetera.ui.service.PhotonNotificationService; import org.marketcetera.ui.service.SessionUser; import org.marketcetera.ui.service.StyleService; @@ -23,9 +20,7 @@ import javafx.application.Application; import javafx.application.Platform; -import javafx.fxml.FXMLLoader; import javafx.geometry.Orientation; -import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.control.Separator; @@ -46,11 +41,19 @@ * @author Colin DuPlantis * @version $Id$ * @since $Release$ - * @see https://openjfx.io/openjfx-docs/#maven */ public class PhotonApp extends Application { + /** + * Main application entry point. + * + * @param args a String[] value + */ + public static void main(String[] args) + { + launch(); + } /* (non-Javadoc) * @see javafx.application.Application#init() */ @@ -58,11 +61,11 @@ public class PhotonApp public void init() throws Exception { + instance = this; super.init(); applicationContext = new AnnotationConfigApplicationContext("org.marketcetera","com.marketcetera"); webMessageService = applicationContext.getBean(UiMessageService.class); styleService = applicationContext.getBean(StyleService.class); - displayLayoutService = applicationContext.getBean(DisplayLayoutService.class); webMessageService.register(this); } /* (non-Javadoc) @@ -106,13 +109,7 @@ public void start(Stage inPrimaryStage) } } inPrimaryStage.setOnCloseRequest(closeEvent -> { - isShuttingDown = true; - webMessageService.post(new LogoutEvent()); - try { - ((ConfigurableApplicationContext)applicationContext).close(); - } catch (Exception ignored) {} - Platform.exit(); - System.exit(0); + doAppShutdown(); }); VBox.setVgrow(menuLayout, Priority.NEVER); @@ -130,6 +127,19 @@ public void start(Stage inPrimaryStage) inPrimaryStage.show(); doLogin(); } + /** + * Shutdown the app. + */ + public void doAppShutdown() + { + isShuttingDown = true; + webMessageService.post(new LogoutEvent()); + try { + ((ConfigurableApplicationContext)applicationContext).close(); + } catch (Exception ignored) {} + Platform.exit(); + System.exit(0); + } /** * Receive LoginEvent values. * @@ -173,6 +183,33 @@ public void onLogout(LogoutEvent inEvent) } }); } + /** + * Get the primary application stage. + * + * @return a Stage value + */ + public static Stage getPrimaryStage() + { + return primaryStage; + } + /** + * Get the main workspace. + * + * @return a Pane value + */ + public static Pane getWorkspace() + { + return workspace; + } + /** + * Get the main singleton application instance. + * + * @return a PhotonApp value + */ + public static PhotonApp getApp() + { + return instance; + } /** * Initialize the workspace footer. */ @@ -213,6 +250,9 @@ private void initializeFooter() clockLabel, userLabel); } + /** + * Build and show the main application menu. + */ private void showMenu() { SessionUser currentUser = SessionUser.getCurrent(); @@ -230,53 +270,15 @@ private void showMenu() } applicationMenu.refreshMenuPermissions(); } + /** + * Perform the login sequence, including showing the login dialog to the user. + */ private void doLogin() { LoginView loginView = applicationContext.getBean(LoginView.class); loginView.showAndWait(); showMenu(); } - static void setRoot(String fxml) - throws IOException - { - scene.setRoot(loadFXML(fxml)); - } - - private static Parent loadFXML(String fxml) - throws IOException - { - FXMLLoader fxmlLoader = new FXMLLoader(PhotonApp.class.getResource(fxml + ".fxml")); - return fxmlLoader.load(); - } - public static Stage getPrimaryStage() - { - return primaryStage; - } - public static Pane getWorkspace() - { - return workspace; - } - public static void main(String[] args) - { - launch(); - } - private Properties displayProperties; - /** - * base key for {@see UserAttributeType} display layout properties - */ - private static final String propId = PhotonApp.class.getSimpleName(); - /** - * workspace width key name - */ - private static final String workspaceWidthProp = propId + "_workspaceWidth"; - /** - * workspace height key name - */ - private static final String workspaceHeightProp = propId + "_workspaceHeight"; - /** - * workspace layout key name - */ - private static final String mainWorkspaceLayoutKey = propId + "_workspaceDisplayLayout"; /** * footer holder for the server connection status image */ @@ -313,7 +315,7 @@ public static void main(String[] args) private ToolBar footerToolBar; private PhotonNotificationService notificationService; /** - * provides access to display layout services + * singleton applcation isntance */ - private DisplayLayoutService displayLayoutService; + private static PhotonApp instance; } diff --git a/photon/src/main/java/org/marketcetera/ui/PhotonServices.java b/photon/src/main/java/org/marketcetera/ui/PhotonServices.java index a5d224feab..6b3212b558 100644 --- a/photon/src/main/java/org/marketcetera/ui/PhotonServices.java +++ b/photon/src/main/java/org/marketcetera/ui/PhotonServices.java @@ -21,6 +21,8 @@ import org.marketcetera.core.BigDecimalUtil; import org.marketcetera.core.time.TimeFactoryImpl; import org.marketcetera.persist.SummaryNDEntityBase; +import org.marketcetera.trade.HasInstrument; +import org.marketcetera.trade.Instrument; import org.marketcetera.ui.service.ServiceManager; import org.marketcetera.ui.service.SessionUser; import org.marketcetera.ui.service.admin.AdminClientService; @@ -183,6 +185,30 @@ public void updateItem(Clazz inData, }; } } + /** + * Render the given column as an Instrument cell. + * + * @param inTableColumn a TableColumn<? extends HasInstrument,Instrument> value + * @return a TableCell<? extends HasInstrument,Instrument> value + */ + public static TableCell renderInstrumentCell(TableColumn inTableColumn) + { + TableCell tableCell = new TableCell<>() { + @Override + protected void updateItem(Instrument inItem, + boolean isEmpty) + { + super.updateItem(inItem, + isEmpty); + this.setText(null); + this.setGraphic(null); + if(!isEmpty && inItem != null){ + this.setText(inItem.getFullSymbol()); + } + } + }; + return tableCell; + } public static TableCell renderNumberCell(TableColumn inTableColumn) { TableCell tableCell = new TableCell<>() { @@ -201,6 +227,37 @@ protected void updateItem(BigDecimal inItem, }; return tableCell; } + /** + * Create a TableCell BigDecimal implementation that is rendered with the given scale. + * + * @param the type of the row item in the table + * @param inTableColumn a TableColumn<T,BigDecimal value + * @param inPreferredScale an int value + * @param inMaxScale an int value + * @return a TableCell<T,BigDecimal> value + */ + public static TableCell renderNumberCell(TableColumn inTableColumn, + int inPreferredScale, + int inMaxScale) + { + TableCell tableCell = new TableCell<>() { + @Override + protected void updateItem(BigDecimal inItem, + boolean isEmpty) + { + super.updateItem(inItem, + isEmpty); + this.setText(null); + this.setGraphic(null); + if(!isEmpty && inItem != null){ + this.setText(BigDecimalUtil.renderDecimal(inItem, + inPreferredScale, + inMaxScale)); + } + } + }; + return tableCell; + } public static TableCell renderCurrencyCell(TableColumn inTableColumn) { TableCell tableCell = new TableCell<>() { diff --git a/photon/src/main/java/org/marketcetera/ui/PrimaryController.java b/photon/src/main/java/org/marketcetera/ui/PrimaryController.java deleted file mode 100644 index 609bf40a4e..0000000000 --- a/photon/src/main/java/org/marketcetera/ui/PrimaryController.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.marketcetera.ui; - -import java.io.IOException; -import javafx.fxml.FXML; - -public class PrimaryController { - - @FXML - private void switchToSecondary() throws IOException { - PhotonApp.setRoot("secondary"); - } -} diff --git a/photon/src/main/java/org/marketcetera/ui/SecondaryController.java b/photon/src/main/java/org/marketcetera/ui/SecondaryController.java deleted file mode 100644 index 9cc72bd1f3..0000000000 --- a/photon/src/main/java/org/marketcetera/ui/SecondaryController.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.marketcetera.ui; - -import java.io.IOException; -import javafx.fxml.FXML; - -public class SecondaryController { - - @FXML - private void switchToPrimary() throws IOException { - PhotonApp.setRoot("primary"); - } -} \ No newline at end of file diff --git a/photon/src/main/java/org/marketcetera/ui/admin/view/PermissionView.java b/photon/src/main/java/org/marketcetera/ui/admin/view/PermissionView.java index 94b054a18f..226eaa8053 100644 --- a/photon/src/main/java/org/marketcetera/ui/admin/view/PermissionView.java +++ b/photon/src/main/java/org/marketcetera/ui/admin/view/PermissionView.java @@ -60,7 +60,7 @@ public class PermissionView * Create a new PermissionView instance. * * @param inParentWindow a Region value - * @param inNewWindowEvent a NewWindowEvent value + * @param inEvent a NewWindowEvent value * @param inViewProperties a Properties value */ public PermissionView(Region inParentWindow, diff --git a/photon/src/main/java/org/marketcetera/ui/admin/view/RoleView.java b/photon/src/main/java/org/marketcetera/ui/admin/view/RoleView.java index 84c0dce5b2..c86c0ca084 100644 --- a/photon/src/main/java/org/marketcetera/ui/admin/view/RoleView.java +++ b/photon/src/main/java/org/marketcetera/ui/admin/view/RoleView.java @@ -70,7 +70,7 @@ public class RoleView * Create a new RoleView instance. * * @param inParentWindow a Region value - * @param inNewWindowEvent a NewWindowEvent value + * @param inEvent a NewWindowEvent value * @param inViewProperties a Properties value */ public RoleView(Region inParentWindow, diff --git a/photon/src/main/java/org/marketcetera/ui/admin/view/UserView.java b/photon/src/main/java/org/marketcetera/ui/admin/view/UserView.java index 63f979d666..995709c6e7 100644 --- a/photon/src/main/java/org/marketcetera/ui/admin/view/UserView.java +++ b/photon/src/main/java/org/marketcetera/ui/admin/view/UserView.java @@ -63,7 +63,7 @@ public class UserView * Create a new UserView instance. * * @param inParentWindow a Region value - * @param inNewWindowEvent a NewWindowEvent value + * @param inEvent a NewWindowEvent value * @param inViewProperties a Properties value */ public UserView(Region inParentWindow, diff --git a/photon/src/main/java/org/marketcetera/ui/events/NewWindowEvent.java b/photon/src/main/java/org/marketcetera/ui/events/NewWindowEvent.java index 1e96e885b5..949dc0f2a7 100644 --- a/photon/src/main/java/org/marketcetera/ui/events/NewWindowEvent.java +++ b/photon/src/main/java/org/marketcetera/ui/events/NewWindowEvent.java @@ -20,7 +20,7 @@ public interface NewWindowEvent /** * Get the icon to display for the window, if any. * - * @return a URL value or null + * @return a URL value or null */ default URL getWindowIcon() { diff --git a/photon/src/main/java/org/marketcetera/ui/fix/view/FixSessionView.java b/photon/src/main/java/org/marketcetera/ui/fix/view/FixSessionView.java index f4317461b6..6e44744cfc 100644 --- a/photon/src/main/java/org/marketcetera/ui/fix/view/FixSessionView.java +++ b/photon/src/main/java/org/marketcetera/ui/fix/view/FixSessionView.java @@ -14,15 +14,12 @@ import java.util.function.Function; import java.util.function.Predicate; -import javax.annotation.PostConstruct; - import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.exception.ExceptionUtils; import org.controlsfx.dialog.Wizard; import org.controlsfx.dialog.Wizard.LinearFlow; import org.controlsfx.dialog.WizardPane; import org.marketcetera.admin.AdminPermissions; -import org.marketcetera.brokers.BrokerStatusListener; import org.marketcetera.cluster.MutableClusterData; import org.marketcetera.cluster.SimpleClusterData; import org.marketcetera.core.Pair; @@ -31,6 +28,7 @@ import org.marketcetera.fix.FixSession; import org.marketcetera.fix.FixSessionAttributeDescriptor; import org.marketcetera.fix.FixSessionDay; +import org.marketcetera.fix.FixSessionInstanceData; import org.marketcetera.fix.FixSessionStatus; import org.marketcetera.fix.MutableActiveFixSession; import org.marketcetera.fix.impl.SimpleActiveFixSession; @@ -75,6 +73,7 @@ import javafx.scene.control.Label; import javafx.scene.control.MenuItem; import javafx.scene.control.SelectionMode; +import javafx.scene.control.TableCell; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.Tooltip; @@ -156,7 +155,7 @@ public String getViewName() * Create a new FixSessionView instance. * * @param inParent a Region value - * @param inNewWindowEvent a NewWindowEvent value + * @param inEvent a NewWindowEvent value * @param inProperties a Properties value */ public FixSessionView(Region inParent, @@ -174,8 +173,9 @@ public FixSessionView(Region inParent, protected void onStart() { fixAdminClient = serviceManager.getService(AdminClientService.class); - rootLayout = new VBox(5); - buttonLayout = new HBox(5); + rootLayout = new VBox(); + buttonLayout = new HBox(); + rootLayout.setPadding(new Insets(10)); addFixSessionButton = new Button("Add FIX Session"); addFixSessionButton.setOnAction(inEvent -> { MutableClusterData clusterData = new SimpleClusterData(); @@ -189,8 +189,9 @@ protected void onStart() true); }); buttonLayout.getChildren().add(addFixSessionButton); + buttonLayout.setPadding(new Insets(5)); + addFixSessionButton.visibleProperty().set(authzHelperService.hasPermission(AdminPermissions.AddSessionAction)); initializeTable(); - fixSessionsTable.prefWidthProperty().bind(getParentWindow().widthProperty()); rootLayout.prefHeightProperty().bind(getParentWindow().heightProperty()); rootLayout.getChildren().addAll(fixSessionsTable, buttonLayout); @@ -244,6 +245,7 @@ public void run() }} ); }); + fixSessionsTable.prefWidthProperty().bind(getParentWindow().widthProperty()); fixSessionsTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); } /** @@ -270,15 +272,16 @@ private void initializeColumns() { nameTableColumn = new TableColumn<>("Name"); nameTableColumn.setCellValueFactory(new PropertyValueFactory<>("name")); - brokerIdTableColumn = new TableColumn<>("BrokerId"); + brokerIdTableColumn = new TableColumn<>("Broker Id"); brokerIdTableColumn.setCellValueFactory(new PropertyValueFactory<>("brokerId")); - hostIdTableColumn = new TableColumn<>("HostId"); + hostIdTableColumn = new TableColumn<>("Host Id"); hostIdTableColumn.setCellValueFactory(new PropertyValueFactory<>("hostId")); statusTableColumn = new TableColumn<>("Status"); statusTableColumn.setCellValueFactory(new PropertyValueFactory<>("status")); - senderSequenceNumberTableColumn = new TableColumn<>("SenderSeqNum"); + statusTableColumn.setCellFactory(tableColumn -> renderFixSessionStatusCell(tableColumn)); + senderSequenceNumberTableColumn = new TableColumn<>("Sender Seq Num"); senderSequenceNumberTableColumn.setCellValueFactory(new PropertyValueFactory<>("senderSeqNum")); - targetSequenceNumberTableColumn = new TableColumn<>("TargetSeqNum"); + targetSequenceNumberTableColumn = new TableColumn<>("Target Seq Num"); targetSequenceNumberTableColumn.setCellValueFactory(new PropertyValueFactory<>("targetSeqNum")); fixSessionsTable.getColumns().add(nameTableColumn); fixSessionsTable.getColumns().add(brokerIdTableColumn); @@ -287,6 +290,30 @@ private void initializeColumns() fixSessionsTable.getColumns().add(senderSequenceNumberTableColumn); fixSessionsTable.getColumns().add(targetSequenceNumberTableColumn); } + /** + * Render the given column as a FIX status cell. + * + * @param inTableColumn a TableColumn<DisplayFixSession,FixSessionStatus> value + * @return a TableCell<DisplayFixSession,FixSessionStatus> value + */ + protected TableCell renderFixSessionStatusCell(TableColumn inTableColumn) + { + TableCell tableCell = new TableCell<>() { + @Override + protected void updateItem(FixSessionStatus inItem, + boolean isEmpty) + { + super.updateItem(inItem, + isEmpty); + this.setText(null); + this.setGraphic(null); + if(!isEmpty && inItem != null){ + this.setText(inItem.getHumanReadable()); + } + } + }; + return tableCell; + } /** * Perform the context menu session action according to the given parameters. * @@ -586,8 +613,6 @@ public void onExitingPage(Wizard inWizard) public void onEnteringPage(Wizard inWizard) { super.onEnteringPage(inWizard); - hostnameTextField.setText(inFixSession.sourceProperty().get().getFixSession().getHost()); - portTextField.setText(String.valueOf(inFixSession.sourceProperty().get().getFixSession().getPort())); if(inFixSession.sourceProperty().get().getFixSession().isAcceptor()) { hostnameTextField.setTooltip(new Tooltip("The acceptor hostname is determined by the server and is not modifiable")); hostnameTextField.setDisable(true); @@ -597,6 +622,9 @@ public void onEnteringPage(Wizard inWizard) testConnectionButton.setVisible(false); testConnectionLabel.setDisable(true); testConnectionLabel.setVisible(false); + FixSessionInstanceData instanceData = AdminClientService.getInstance().getFixSessionInstanceData(inFixSession.sourceProperty().get().getFixSession().getAffinity()); + hostnameTextField.setText(instanceData.getHostname()); + portTextField.setText(String.valueOf(instanceData.getPort())); } else { hostnameTextField.setTooltip(new Tooltip("Hostname of the FIX gateway to connect to")); hostnameTextField.setDisable(false); @@ -606,6 +634,13 @@ public void onEnteringPage(Wizard inWizard) testConnectionButton.setVisible(!networkInvalid.get()); testConnectionLabel.setDisable(networkInvalid.get()); testConnectionLabel.setVisible(!networkInvalid.get()); + if(inIsNew) { + hostnameTextField.setText("exchange.marketcetera.com"); + portTextField.setText("7004"); + } else { + hostnameTextField.setText(inFixSession.sourceProperty().get().getFixSession().getHost()); + portTextField.setText(String.valueOf(inFixSession.sourceProperty().get().getFixSession().getPort())); + } } inWizard.invalidProperty().bind(networkInvalid); } diff --git a/photon/src/main/java/org/marketcetera/ui/marketdata/view/MarketDataDetailView.java b/photon/src/main/java/org/marketcetera/ui/marketdata/view/MarketDataDetailView.java index 89c07efac5..7306917711 100644 --- a/photon/src/main/java/org/marketcetera/ui/marketdata/view/MarketDataDetailView.java +++ b/photon/src/main/java/org/marketcetera/ui/marketdata/view/MarketDataDetailView.java @@ -24,9 +24,9 @@ import org.marketcetera.ui.PhotonServices; import org.marketcetera.ui.events.NewWindowEvent; import org.marketcetera.ui.marketdata.event.MarketDataDetailEvent; -import org.marketcetera.ui.marketdata.event.MarketDataSuggestionEvent; import org.marketcetera.ui.marketdata.service.MarketDataClientService; import org.marketcetera.ui.service.trade.TradeClientService; +import org.marketcetera.ui.trade.event.SuggestionEvent; import org.marketcetera.ui.view.AbstractContentView; import org.marketcetera.ui.view.ContentView; import org.marketcetera.util.log.SLF4JLoggerProxy; @@ -169,7 +169,7 @@ protected void onStart() * Create a new MarketDataDetailView instance. * * @param inParent a Region value - * @param inNewWindowEvent a NewWindowEvent value + * @param inEvent a NewWindowEvent value * @param inProperties a Properties value */ public MarketDataDetailView(Region inParent, @@ -313,8 +313,9 @@ private void buyOrSellAction(Side inSide, suggestion.setIdentifier("Market Data List View Action"); suggestion.setScore(BigDecimal.ONE); suggestion.setOrder(orderSingle); - uiMessageService.post(new MarketDataSuggestionEvent(inSide.name() + " " + marketDataInstrument.getSymbol(), - suggestion)); + uiMessageService.post(applicationContext.getBean(SuggestionEvent.class, + inSide.name() + " " + marketDataInstrument.getSymbol(), + suggestion)); } /** * Execute the market data request. @@ -391,7 +392,6 @@ private void updateViewProperties() getViewProperties().setProperty(symbolKey, marketDataInstrument.getFullSymbol()); } - System.out.println("COCO: view properties are now " + getViewProperties()); } /** * Update the display table. diff --git a/photon/src/main/java/org/marketcetera/ui/marketdata/view/MarketDataItem.java b/photon/src/main/java/org/marketcetera/ui/marketdata/view/MarketDataItem.java index 680c9207e9..4517f2e657 100644 --- a/photon/src/main/java/org/marketcetera/ui/marketdata/view/MarketDataItem.java +++ b/photon/src/main/java/org/marketcetera/ui/marketdata/view/MarketDataItem.java @@ -99,7 +99,7 @@ public ReadOnlyStringProperty tradeExchangeProperty() /** * Get the lastPriceProperty value. * - * @return a ReadOnlyObjectProperty value + * @return a ReadOnlyObjectProperty<BigDecimal> value */ public ReadOnlyObjectProperty lastPriceProperty() { @@ -108,7 +108,7 @@ public ReadOnlyObjectProperty lastPriceProperty() /** * Get the lastQuantityProperty value. * - * @return a ReadOnlyObjectProperty value + * @return a ReadOnlyObjectProperty<BigDecimal> value */ public ReadOnlyObjectProperty lastQuantityProperty() { @@ -117,7 +117,7 @@ public ReadOnlyObjectProperty lastQuantityProperty() /** * Get the tradeTimestampProperty value. * - * @return a ReadOnlyObjectProperty value + * @return a ReadOnlyObjectProperty<DateTime> value */ public ReadOnlyObjectProperty tradeTimestampProperty() { @@ -126,7 +126,7 @@ public ReadOnlyObjectProperty tradeTimestampProperty() /** * Get the bidTimestampProperty value. * - * @return a ReadOnlyObjectProperty value + * @return a ReadOnlyObjectProperty<DateTime> value */ public ReadOnlyObjectProperty bidTimestampProperty() { @@ -135,7 +135,7 @@ public ReadOnlyObjectProperty bidTimestampProperty() /** * Get the askTimestampProperty value. * - * @return a ReadOnlyObjectProperty value + * @return a ReadOnlyObjectProperty<DateTime> value */ public ReadOnlyObjectProperty askTimestampProperty() { @@ -162,7 +162,7 @@ public ReadOnlyStringProperty askExchangeProperty() /** * Get the bidQuantityProperty value. * - * @return a ReadOnlyObjectProperty value + * @return a ReadOnlyObjectProperty<BigDecimal> value */ public ReadOnlyObjectProperty bidQuantityProperty() { @@ -171,7 +171,7 @@ public ReadOnlyObjectProperty bidQuantityProperty() /** * Get the bidPriceProperty value. * - * @return a ReadOnlyObjectProperty value + * @return a ReadOnlyObjectProperty<BigDecimal> value */ public ReadOnlyObjectProperty bidPriceProperty() { @@ -180,7 +180,7 @@ public ReadOnlyObjectProperty bidPriceProperty() /** * Get the askPriceProperty value. * - * @return a ReadOnlyObjectProperty value + * @return a ReadOnlyObjectProperty<BigDecimal> value */ public ReadOnlyObjectProperty askPriceProperty() { @@ -189,7 +189,7 @@ public ReadOnlyObjectProperty askPriceProperty() /** * Get the askQuantityProperty value. * - * @return a ReadOnlyObjectProperty value + * @return a ReadOnlyObjectProperty<BigDecimal> value */ public ReadOnlyObjectProperty askQuantityProperty() { @@ -198,7 +198,7 @@ public ReadOnlyObjectProperty askQuantityProperty() /** * Get the previousClosePriceProperty value. * - * @return a ReadOnlyObjectProperty value + * @return a ReadOnlyObjectProperty<BigDecimal> value */ public ReadOnlyObjectProperty previousClosePriceProperty() { @@ -207,7 +207,7 @@ public ReadOnlyObjectProperty previousClosePriceProperty() /** * Get the openPriceProperty value. * - * @return a ReadOnlyObjectProperty value + * @return a ReadOnlyObjectProperty<BigDecimal> value */ public ReadOnlyObjectProperty openPriceProperty() { @@ -216,7 +216,7 @@ public ReadOnlyObjectProperty openPriceProperty() /** * Get the highPriceProperty value. * - * @return a ReadOnlyObjectProperty value + * @return a ReadOnlyObjectProperty<BigDecimal> value */ public ReadOnlyObjectProperty highPriceProperty() { @@ -225,7 +225,7 @@ public ReadOnlyObjectProperty highPriceProperty() /** * Get the lowPriceProperty value. * - * @return a ReadOnlyObjectProperty value + * @return a ReadOnlyObjectProperty<BigDecimal> value */ public ReadOnlyObjectProperty lowPriceProperty() { @@ -234,7 +234,7 @@ public ReadOnlyObjectProperty lowPriceProperty() /** * Get the closePriceProperty value. * - * @return a ReadOnlyObjectProperty value + * @return a ReadOnlyObjectProperty<BigDecimal> value */ public ReadOnlyObjectProperty closePriceProperty() { @@ -243,7 +243,7 @@ public ReadOnlyObjectProperty closePriceProperty() /** * Get the tradeVolumeProperty value. * - * @return a ReadOnlyObjectProperty value + * @return a ReadOnlyObjectProperty<BigDecimal> value */ public ReadOnlyObjectProperty tradeVolumeProperty() { @@ -252,7 +252,7 @@ public ReadOnlyObjectProperty tradeVolumeProperty() /** * Get the provider property value. * - * @return a ReadOnlyStringProperty,/code> value + * @return a ReadOnlyStringProperty value */ public ReadOnlyStringProperty providerProperty() { diff --git a/photon/src/main/java/org/marketcetera/ui/marketdata/view/MarketDataListView.java b/photon/src/main/java/org/marketcetera/ui/marketdata/view/MarketDataListView.java index 645b2d9b42..8f0bf07187 100644 --- a/photon/src/main/java/org/marketcetera/ui/marketdata/view/MarketDataListView.java +++ b/photon/src/main/java/org/marketcetera/ui/marketdata/view/MarketDataListView.java @@ -24,9 +24,9 @@ import org.marketcetera.ui.events.NewWindowEvent; import org.marketcetera.ui.events.NotificationEvent; import org.marketcetera.ui.marketdata.event.MarketDataDetailEvent; -import org.marketcetera.ui.marketdata.event.MarketDataSuggestionEvent; import org.marketcetera.ui.marketdata.service.MarketDataClientService; import org.marketcetera.ui.service.trade.TradeClientService; +import org.marketcetera.ui.trade.event.SuggestionEvent; import org.marketcetera.ui.view.AbstractContentView; import org.marketcetera.ui.view.ContentView; import org.marketcetera.util.log.SLF4JLoggerProxy; @@ -161,7 +161,7 @@ protected void onClientDisconnect() * Create a new MarketDataListView instance. * * @param inParent a Region value - * @param inNewWindowEvent a NewWindowEvent value + * @param inEvent a NewWindowEvent value * @param inProperties a Properties value */ public MarketDataListView(Region inParent, @@ -425,8 +425,9 @@ private void buyOrSellAction(MarketDataItem inSelectedItem, suggestion.setIdentifier("Market Data List View Action"); suggestion.setScore(BigDecimal.ONE); suggestion.setOrder(orderSingle); - uiMessageService.post(new MarketDataSuggestionEvent(inSide.name() + " " + inSelectedItem.symbolProperty().get(), - suggestion)); + uiMessageService.post(applicationContext.getBean(SuggestionEvent.class, + inSide.name() + " " + inSelectedItem.symbolProperty().get(), + suggestion)); } /** * Prepare a nice, human-readable rendering of the given market data item. diff --git a/photon/src/main/java/org/marketcetera/ui/marketdata/view/MarketDataQuoteItem.java b/photon/src/main/java/org/marketcetera/ui/marketdata/view/MarketDataQuoteItem.java index 4bf5d0fa17..56e3939347 100644 --- a/photon/src/main/java/org/marketcetera/ui/marketdata/view/MarketDataQuoteItem.java +++ b/photon/src/main/java/org/marketcetera/ui/marketdata/view/MarketDataQuoteItem.java @@ -20,7 +20,7 @@ /* $License$ */ /** - * + * Provides a display implementation of a market data quote. * * @author Colin DuPlantis * @version $Id$ @@ -28,6 +28,11 @@ */ public class MarketDataQuoteItem { + /** + * Create a new MarketDataQuoteItem instance. + * + * @param inInstrument an Instrument value + */ public MarketDataQuoteItem(Instrument inInstrument) { instrument = inInstrument; @@ -40,7 +45,7 @@ public MarketDataQuoteItem(Instrument inInstrument) /** * Create a new MarketDataQuoteItem instance. * - * @param inQuoteEvent + * @param inQuoteEvent a QuoteEvent value */ public MarketDataQuoteItem(QuoteEvent inQuoteEvent) { @@ -57,7 +62,7 @@ public MarketDataQuoteItem(QuoteEvent inQuoteEvent) /** * Get the quoteActionProperty value. * - * @return a ObjectProperty value + * @return an ObjectProperty<QuoteAction> value */ public ObjectProperty quoteActionProperty() { @@ -66,7 +71,7 @@ public ObjectProperty quoteActionProperty() /** * Get the eventTypeProperty value. * - * @return a ObjectProperty value + * @return an ObjectProperty<EventType> value */ public ObjectProperty eventTypeProperty() { @@ -75,7 +80,7 @@ public ObjectProperty eventTypeProperty() /** * Get the quoteLevelProperty value. * - * @return a IntegerProperty value + * @return an IntegerProperty value */ public IntegerProperty quoteLevelProperty() { @@ -84,7 +89,7 @@ public IntegerProperty quoteLevelProperty() /** * Get the quoteCountProperty value. * - * @return a IntegerProperty value + * @return an IntegerProperty value */ public IntegerProperty quoteCountProperty() { @@ -102,7 +107,7 @@ public StringProperty symbolProperty() /** * Get the timestampProperty value. * - * @return a ObjectProperty value + * @return an ObjectProperty<DateTime> value */ public ObjectProperty timestampProperty() { @@ -120,7 +125,7 @@ public StringProperty exchangeProperty() /** * Get the quantityProperty value. * - * @return a ObjectProperty value + * @return an ObjectProperty<BigDecimal> value */ public ObjectProperty quantityProperty() { @@ -129,12 +134,17 @@ public ObjectProperty quantityProperty() /** * Get the priceProperty value. * - * @return a ObjectProperty value + * @return an ObjectProperty<BigDecimal> value */ public ObjectProperty priceProperty() { return priceProperty; } + /** + * Update the item with the given event. + * + * @param inEvent an Event value + */ public void update(Event inEvent) { SLF4JLoggerProxy.trace(this, @@ -152,14 +162,44 @@ public void update(Event inEvent) quoteCountProperty.set(quoteEvent.getCount()); } } + /** + * quote action property value + */ private final ObjectProperty quoteActionProperty = new SimpleObjectProperty<>(); + /** + * event type property value + */ private final ObjectProperty eventTypeProperty = new SimpleObjectProperty<>(); + /** + * quote level property value + */ private final IntegerProperty quoteLevelProperty = new SimpleIntegerProperty(); + /** + * quote count property value + */ private final IntegerProperty quoteCountProperty = new SimpleIntegerProperty(); + /** + * instrument value + */ private final Instrument instrument; + /** + * symbol property + */ private final StringProperty symbolProperty; + /** + * timestamp property + */ private final ObjectProperty timestampProperty; + /** + * exchange property + */ private final StringProperty exchangeProperty; + /** + * quantity property + */ private final ObjectProperty quantityProperty; + /** + * price property + */ private final ObjectProperty priceProperty; } diff --git a/photon/src/main/java/org/marketcetera/ui/service/SessionUser.java b/photon/src/main/java/org/marketcetera/ui/service/SessionUser.java index 0b93e7e16b..b2cebc1975 100644 --- a/photon/src/main/java/org/marketcetera/ui/service/SessionUser.java +++ b/photon/src/main/java/org/marketcetera/ui/service/SessionUser.java @@ -93,8 +93,8 @@ public Set getPermissions() *

* The fully qualified name of the type is used as the name when getting the * value. The outcome of calling this method is thus the same as if - * calling
- *
+ * calling + * * getAttribute(type.getName()); * * @see #setAttribute(Class, Object) @@ -142,8 +142,7 @@ public Object getAttribute(String name) { *

* The fully qualified name of the type is used as the name when storing the * value. The outcome of calling this method is thus the same as if - * calling
- *
+ * calling * setAttribute(type.getName(), value); * * @see #getAttribute(Class) diff --git a/photon/src/main/java/org/marketcetera/ui/service/StyleService.java b/photon/src/main/java/org/marketcetera/ui/service/StyleService.java index fa9678cfc7..7063b95f93 100644 --- a/photon/src/main/java/org/marketcetera/ui/service/StyleService.java +++ b/photon/src/main/java/org/marketcetera/ui/service/StyleService.java @@ -39,32 +39,42 @@ public void start() PlatformServices.getServiceName(getClass())); } /** + * Add styles to the given view. * - * - * @param inContentView + * @param inContentView a ContentView value */ public void addStyle(ContentView inContentView) { // addStyle(inContentView.getScene()); } /** + * Add styles to the given scene. * - * - * @param inContentView + * @param inScene a Scene value */ - public void addStyle(Scene scene) + public void addStyle(Scene inScene) { - Parent root = scene.getRoot(); + Parent root = inScene.getRoot(); for(Node node : root.getChildrenUnmodifiable()) { addStyle(node); } } - public void addStyleToAll(Node...inComponents) + /** + * Add styles to the given nodes. + * + * @param inNodes a Node[] value + */ + public void addStyleToAll(Node...inNodes) { - for(Node node : inComponents) { + for(Node node : inNodes) { addStyle(node); } } + /** + * Add style to the given node. + * + * @param inComponent a Node value + */ public void addStyle(Node inComponent) { // String componentId = inComponent.getId(); @@ -82,6 +92,13 @@ public void addStyle(Node inComponent) // componentId, // inComponent); } + /** + * Apply style to the node with the given key. + * + * @param inIndex an int value + * @param inKey a String value + * @param inComponent a Node value + */ private void applyStyle(int inIndex, String inKey, Node inComponent) diff --git a/photon/src/main/java/org/marketcetera/ui/service/WindowManagerService.java b/photon/src/main/java/org/marketcetera/ui/service/WindowManagerService.java index 5cf512c9dc..7ed0f91a56 100644 --- a/photon/src/main/java/org/marketcetera/ui/service/WindowManagerService.java +++ b/photon/src/main/java/org/marketcetera/ui/service/WindowManagerService.java @@ -46,6 +46,7 @@ import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; +import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Node; import javafx.scene.control.Label; @@ -439,6 +440,9 @@ private WindowLayout(NewWindowEvent inEvent, mainScrollPane = new ScrollPane(); mainScrollPane.setContent(contentLayout); mainScrollPane.setPannable(true); + mainScrollPane.setPadding(new Insets(5)); + mainScrollPane.setFitToHeight(true); + mainScrollPane.setFitToWidth(true); scrollHorizontalProperty.bind(mainScrollPane.hvalueProperty()); scrollVerticalProperty.bind(mainScrollPane.vvalueProperty()); windowLayout.getChildren().addAll(windowTitleLayout, @@ -555,7 +559,7 @@ public void onResize(Node inNode, */ private void setupWindowListeners() { - closeImage.setOnMouseClicked(event -> { + closeButtonLayout.setOnMouseClicked(event -> { contentViewProperty.get().onClose(); close(); }); diff --git a/photon/src/main/java/org/marketcetera/ui/service/trade/TradeClientService.java b/photon/src/main/java/org/marketcetera/ui/service/trade/TradeClientService.java index 50b9d4df3c..aa0d3d7335 100644 --- a/photon/src/main/java/org/marketcetera/ui/service/trade/TradeClientService.java +++ b/photon/src/main/java/org/marketcetera/ui/service/trade/TradeClientService.java @@ -18,6 +18,8 @@ import org.marketcetera.trade.OrderSummary; import org.marketcetera.trade.Report; import org.marketcetera.trade.ReportID; +import org.marketcetera.trade.Suggestion; +import org.marketcetera.trade.SuggestionListener; import org.marketcetera.trade.TradeMessageListener; import org.marketcetera.trade.client.SendOrderResponse; import org.marketcetera.trade.client.TradeClient; @@ -192,6 +194,33 @@ public SendOrderResponse send(Order inOrder) { return tradeClient.sendOrder(inOrder); } + /** + * Submit a trade suggestion. + * + * @param inSuggestion a Suggestion value + */ + public void sendOrderSuggestion(Suggestion inSuggestion) + { + tradeClient.sendOrderSuggestion(inSuggestion); + } + /** + * Add the given suggestion listener. + * + * @param inSuggestionListener a SuggestionListener value + */ + public void addSuggestionListener(SuggestionListener inSuggestionListener) + { + tradeClient.addSuggestionListener(inSuggestionListener); + } + /** + * Remove the given suggestion listener. + * + * @param inSuggestionListener a SuggestionListener value + */ + public void removeSuggestionListener(SuggestionListener inSuggestionListener) + { + tradeClient.removeSuggestionListener(inSuggestionListener); + } /* (non-Javadoc) * @see org.marketcetera.web.service.ConnectableService#isRunning() */ diff --git a/photon/src/main/java/org/marketcetera/ui/strategy/service/StrategyClientService.java b/photon/src/main/java/org/marketcetera/ui/strategy/service/StrategyClientService.java index efa9ce8de6..de1a701f7c 100644 --- a/photon/src/main/java/org/marketcetera/ui/strategy/service/StrategyClientService.java +++ b/photon/src/main/java/org/marketcetera/ui/strategy/service/StrategyClientService.java @@ -92,6 +92,24 @@ public boolean isRunning() { return strategyClient != null && strategyClient.isRunning(); } + /** + * Delete the strategy message with the given unique identifier. + * + * @param inStrategyMessageId a long value + */ + public void deleteStrategyMessage(long inStrategyMessageId) + { + strategyClient.deleteStrategyMessage(inStrategyMessageId); + } + /** + * Delete all strategy messages for the given strategy instance. + * + * @param inStrategyInstanceName a String value + */ + public void deleteAllStrategyMessages(String inStrategyInstanceName) + { + strategyClient.deleteAllStrategyMessages(inStrategyInstanceName); + } /** * Unload a strategy instance. * @@ -114,7 +132,7 @@ public static StrategyClientService getInstance() * Finds the strategy instance with the given name. * * @param inName a String value - * @returns a java.util.Optional value + * @return a java.util.Optional<? extends StrategyInstance> value */ public Optional findByName(String inName) { @@ -123,7 +141,7 @@ public Optional findByName(String inName) /** * Requests loaded strategy instances. * - * @returns a Collection<? extends StrategyInstance> value + * @return a Collection<? extends StrategyInstance> value */ public Collection getStrategyInstances() { @@ -135,7 +153,7 @@ public Collection getStrategyInstances() * @param inStrategyName a String value * @param inSeverity a Severity value * @param inPageRequest an PageRequest value - * @returns a CollectionPageResponse<? extends StrategyMessage> value + * @return a CollectionPageResponse<? extends StrategyMessage> value */ public CollectionPageResponse getStrategyMessages(String inStrategyName, Severity inSeverity, diff --git a/photon/src/main/java/org/marketcetera/ui/strategy/view/DisplayStrategyMessage.java b/photon/src/main/java/org/marketcetera/ui/strategy/view/DisplayStrategyMessage.java index 437c9cbb99..09f625301f 100644 --- a/photon/src/main/java/org/marketcetera/ui/strategy/view/DisplayStrategyMessage.java +++ b/photon/src/main/java/org/marketcetera/ui/strategy/view/DisplayStrategyMessage.java @@ -4,9 +4,12 @@ import org.marketcetera.core.notifications.INotification.Severity; import org.marketcetera.strategy.StrategyMessage; +import javafx.beans.property.LongProperty; import javafx.beans.property.ObjectProperty; +import javafx.beans.property.ReadOnlyLongProperty; import javafx.beans.property.ReadOnlyObjectProperty; import javafx.beans.property.ReadOnlyStringProperty; +import javafx.beans.property.SimpleLongProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; @@ -14,7 +17,7 @@ /* $License$ */ /** - * + * Provides a UI implementation of a {@link StrategyMessage}. * * @author Colin DuPlantis * @version $Id$ @@ -30,23 +33,24 @@ public class DisplayStrategyMessage public DisplayStrategyMessage(StrategyMessage inStrategyMessage) { messageProperty.set(inStrategyMessage.getMessage()); + strategyIdProperty.set(inStrategyMessage.getStrategyMessageId()); severityProperty.set(inStrategyMessage.getSeverity()); - strategyIdProperty.set(inStrategyMessage.getStrategyInstance().getName()); + strategyNameProperty.set(inStrategyMessage.getStrategyInstance().getName()); timestampProperty.set(new DateTime(inStrategyMessage.getMessageTimestamp())); } /** - * the strategyIdProperty value. + * the strategyNameProperty value. * - * @return a StringProperty value + * @return a ReadOnlyStringProperty value */ - public ReadOnlyStringProperty strategyIdProperty() + public ReadOnlyStringProperty strategyNameProperty() { - return strategyIdProperty; + return strategyNameProperty; } /** * the timestampProperty value. * - * @return a ObjectProperty value + * @return a ReadOnlyObjectProperty<DateTime> value */ public ReadOnlyObjectProperty timestampProperty() { @@ -55,33 +59,48 @@ public ReadOnlyObjectProperty timestampProperty() /** * the severityProperty value. * - * @return a ObjectProperty value + * @return a ReadOnlyObjectProperty<Severity> value */ public ReadOnlyObjectProperty severityProperty() { return severityProperty; } /** - * the eventTypeProperty value. + * the messageProperty value. * - * @return a StringProperty value + * @return a ReadOnlyStringProperty value */ - public ReadOnlyStringProperty eventTypeProperty() + public ReadOnlyStringProperty messageProperty() { - return eventTypeProperty; + return messageProperty; } /** - * the messageProperty value. + * Get the strategyIdProperty value. * - * @return a StringProperty value + * @return a ReadOnlyLongProperty value */ - public ReadOnlyStringProperty messageProperty() + public ReadOnlyLongProperty strategyIdProperty() { - return messageProperty; + return strategyIdProperty; } - private final StringProperty strategyIdProperty = new SimpleStringProperty(); + /** + * holds the strategy message id property + */ + private final LongProperty strategyIdProperty = new SimpleLongProperty(); + /** + * holds the strategy instance name property + */ + private final StringProperty strategyNameProperty = new SimpleStringProperty(); + /** + * holds the strategy message timestamp property + */ private final ObjectProperty timestampProperty = new SimpleObjectProperty<>(); + /** + * holds the strategy message severity property + */ private final ObjectProperty severityProperty = new SimpleObjectProperty<>(); - private final StringProperty eventTypeProperty = new SimpleStringProperty(); + /** + * holds the strategy message message property + */ private final StringProperty messageProperty = new SimpleStringProperty(); } diff --git a/photon/src/main/java/org/marketcetera/ui/strategy/view/StrategyView.java b/photon/src/main/java/org/marketcetera/ui/strategy/view/StrategyView.java index 29dfb6a90b..4036557b0c 100644 --- a/photon/src/main/java/org/marketcetera/ui/strategy/view/StrategyView.java +++ b/photon/src/main/java/org/marketcetera/ui/strategy/view/StrategyView.java @@ -43,6 +43,9 @@ import org.marketcetera.ui.strategy.service.StrategyClientService; import org.marketcetera.ui.view.AbstractContentView; import org.marketcetera.util.log.SLF4JLoggerProxy; +import org.nocrala.tools.texttablefmt.BorderStyle; +import org.nocrala.tools.texttablefmt.ShownBorders; +import org.nocrala.tools.texttablefmt.Table; import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.boot.autoconfigure.AutoConfiguration; @@ -142,7 +145,7 @@ public void changed(ObservableValue inObservable, filterLayout.setPadding(new Insets(10,10,10,10)); int rowCount = 0; int colCount = 0; - filterLayout.add(new Label("Strategy Id"),colCount,rowCount); + filterLayout.add(new Label("Strategy Name"),colCount,rowCount); filterLayout.add(strategyNameComboBox,++colCount,rowCount); filterLayout.add(new Label("Severity"),++colCount,rowCount); filterLayout.add(severityComboBox,++colCount,rowCount); @@ -151,11 +154,10 @@ public void changed(ObservableValue inObservable, loadStrategyButton.setOnAction(event -> loadStrategy()); buttonLayout = new HBox(10); buttonLayout.getChildren().add(loadStrategyButton); - strategyTable.prefWidthProperty().bind(getParentWindow().widthProperty()); - eventTable.prefWidthProperty().bind(getParentWindow().widthProperty()); + strategyTable.prefWidthProperty().bind(mainLayout.widthProperty()); + eventTable.prefWidthProperty().bind(mainLayout.widthProperty()); strategyTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); eventTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); - mainLayout.prefHeightProperty().bind(getParentWindow().heightProperty()); mainLayout.getChildren().addAll(strategyTable, new Separator(Orientation.HORIZONTAL), buttonLayout, @@ -237,7 +239,7 @@ protected void onClientDisconnect() * Create a new StrategyView instance. * * @param inParent a Region value - * @param inNewWindowEvent a NewWindowEvent value + * @param inEvent a NewWindowEvent value * @param inProperties a Properties value */ public StrategyView(Region inParent, @@ -602,7 +604,7 @@ private void initializeEventTable() private void initializeEventTableColumns() { eventStrategyNameColumn = new TableColumn<>("Strategy"); - eventStrategyNameColumn.setCellValueFactory(new PropertyValueFactory<>("strategyId")); + eventStrategyNameColumn.setCellValueFactory(new PropertyValueFactory<>("strategyName")); eventTimestampColumn = new TableColumn<>("Timestamp"); eventTimestampColumn.setCellValueFactory(new PropertyValueFactory<>("timestamp")); eventTimestampColumn.setCellFactory(tableColumn -> PhotonServices.renderDateTimeCell(tableColumn)); @@ -637,6 +639,46 @@ private void initializeStrategyTableColumns() enableStrategyContextMenuItems(inNewValue); }); } + /** + * Get the selected strategy messages. + * + * @return a Collection<DisplayStrategyMessage> value + */ + private Collection getSelectedMessages() + { + return eventTable.getSelectionModel().getSelectedItems(); + } + /** + * Create a human-readable representation of the given strategy messages. + * + * @param inStrategyMessages a Collection<DisplayStrategymessage> value + * @return a String value + */ + private String renderStrategyMessages(Collection inStrategyMessages) + { + Table table = new Table(4, + BorderStyle.CLASSIC_COMPATIBLE_WIDE, + ShownBorders.ALL, + false); + table.addCell("Strategy Messages", + PlatformServices.cellStyle, + 4); + table.addCell("Timestamp", + PlatformServices.cellStyle); + table.addCell("Strategy", + PlatformServices.cellStyle); + table.addCell("Severity", + PlatformServices.cellStyle); + table.addCell("Message", + PlatformServices.cellStyle); + for(DisplayStrategyMessage message : inStrategyMessages) { + table.addCell(String.valueOf(message.timestampProperty().get())); + table.addCell(message.strategyNameProperty().get()); + table.addCell(message.severityProperty().get().name()); + table.addCell(message.messageProperty().get()); + } + return table.render(); + } /** * Initialize the event context menu. */ @@ -645,17 +687,36 @@ private void initializeEventContextMenu() eventTableContextMenu = new ContextMenu(); copyStrategyEventMenuItem = new MenuItem("Copy"); copyStrategyEventMenuItem.setOnAction(event -> { - DisplayStrategyMessage message = eventTable.getSelectionModel().getSelectedItem(); - if(message == null) { + Collection selectedItems = getSelectedMessages(); + if(selectedItems == null || selectedItems.isEmpty()) { return; } Clipboard clipboard = Clipboard.getSystemClipboard(); ClipboardContent clipboardContent = new ClipboardContent(); - String output = message.messageProperty().get(); - clipboardContent.putString(output); + clipboardContent.putString(renderStrategyMessages(selectedItems)); clipboard.setContent(clipboardContent); }); deleteStrategyEventMenuItem = new MenuItem("Delete"); + deleteStrategyEventMenuItem.setOnAction(event -> { + Collection selectedItems = getSelectedMessages(); + if(selectedItems == null || selectedItems.isEmpty()) { + return; + } + for(DisplayStrategyMessage message : selectedItems) { + try { + strategyClient.deleteStrategyMessage(message.strategyIdProperty().get()); + uiMessageService.post(new NotificationEvent("Delete Strategy", + "Strategy message deleted", + AlertType.INFORMATION)); + updateEvents(); + } catch (Exception e) { + String errorMessage = PlatformServices.getMessage(e); + uiMessageService.post(new NotificationEvent("Delete Strategy Message", + "Unable to delete strategy message: " + errorMessage, + AlertType.ERROR)); + } + } + }); eventTableContextMenu.getItems().addAll(copyStrategyEventMenuItem, new SeparatorMenuItem(), deleteStrategyEventMenuItem); @@ -749,6 +810,24 @@ private void initializeStrategyContextMenu() } stopStrategy(selectedStrategy); }); + clearEventsMenuItem.setOnAction(event -> { + DisplayStrategyInstance selectedStrategy = strategyTable.getSelectionModel().getSelectedItem(); + if(selectedStrategy == null) { + return; + } + try { + strategyClient.deleteAllStrategyMessages(selectedStrategy.strategyNameProperty().get()); + uiMessageService.post(new NotificationEvent("Delete All Strategy Messages", + "Strategy messages deleted", + AlertType.INFORMATION)); + updateEvents(); + } catch (Exception e) { + String errorMessage = PlatformServices.getMessage(e); + uiMessageService.post(new NotificationEvent("Delete Strategy All Messages", + "Unable to delete strategy messages: " + errorMessage, + AlertType.ERROR)); + } + }); boolean firstGroup = false; if(authzHelperService.hasPermission(StrategyPermissions.StartStrategyAction)) { firstGroup = true; @@ -762,10 +841,10 @@ private void initializeStrategyContextMenu() firstGroup = true; strategyTableContextMenu.getItems().add(unloadStrategyMenuItem); } - if(authzHelperService.hasPermission(StrategyPermissions.CancelStrategyUploadAction)) { - firstGroup = true; - strategyTableContextMenu.getItems().add(cancelStrategyUploadMenuItem); - } +// if(authzHelperService.hasPermission(StrategyPermissions.CancelStrategyUploadAction)) { +// firstGroup = true; +// strategyTableContextMenu.getItems().add(cancelStrategyUploadMenuItem); +// } if(authzHelperService.hasPermission(StrategyPermissions.ClearStrategyEventsAction)) { if(firstGroup) { strategyTableContextMenu.getItems().add(new SeparatorMenuItem()); diff --git a/photon/src/main/java/org/marketcetera/ui/strategy/view/StrategyViewFactory.java b/photon/src/main/java/org/marketcetera/ui/strategy/view/StrategyViewFactory.java index deebaf44b6..0be6e53c4a 100644 --- a/photon/src/main/java/org/marketcetera/ui/strategy/view/StrategyViewFactory.java +++ b/photon/src/main/java/org/marketcetera/ui/strategy/view/StrategyViewFactory.java @@ -19,7 +19,7 @@ /* $License$ */ /** - * + * Creates {@link StrategyView} objects. * * @author Colin DuPlantis * @version $Id$ diff --git a/photon/src/main/java/org/marketcetera/ui/trade/event/AbstractOrderTicketEvent.java b/photon/src/main/java/org/marketcetera/ui/trade/event/AbstractOrderTicketEvent.java index fd8e327a87..e0962af6e9 100644 --- a/photon/src/main/java/org/marketcetera/ui/trade/event/AbstractOrderTicketEvent.java +++ b/photon/src/main/java/org/marketcetera/ui/trade/event/AbstractOrderTicketEvent.java @@ -2,8 +2,10 @@ import java.net.URL; +import org.marketcetera.core.Pair; import org.marketcetera.ui.events.NewWindowEvent; import org.marketcetera.ui.trade.view.orderticket.OrderTicketViewFactory; +import org.marketcetera.ui.view.ContentViewFactory; import org.springframework.beans.factory.annotation.Autowired; /* $License$ */ @@ -26,6 +28,23 @@ public URL getWindowIcon() { return orderViewFactory.getMenuIcon(); } + /* (non-Javadoc) + * @see org.marketcetera.ui.events.NewWindowEvent#getWindowSize() + */ + @Override + public Pair getWindowSize() + { + return Pair.create(850.0, + 200.0); + } + /* (non-Javadoc) + * @see org.marketcetera.web.events.NewWindowEvent#getViewFactoryType() + */ + @Override + public Class getViewFactoryType() + { + return OrderTicketViewFactory.class; + } /** * constructs order views */ diff --git a/photon/src/main/java/org/marketcetera/ui/trade/event/ReplaceOrderEvent.java b/photon/src/main/java/org/marketcetera/ui/trade/event/ReplaceOrderEvent.java index 2597b49aaf..39e5ef53c9 100644 --- a/photon/src/main/java/org/marketcetera/ui/trade/event/ReplaceOrderEvent.java +++ b/photon/src/main/java/org/marketcetera/ui/trade/event/ReplaceOrderEvent.java @@ -2,11 +2,8 @@ import java.util.Properties; -import org.marketcetera.core.Pair; import org.marketcetera.trade.ExecutionReport; import org.marketcetera.trade.HasExecutionReport; -import org.marketcetera.ui.trade.view.orderticket.OrderTicketViewFactory; -import org.marketcetera.ui.view.ContentViewFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; @@ -42,14 +39,6 @@ public String getWindowTitle() { return "Replace " + executionReport.getOrderID(); } - /* (non-Javadoc) - * @see org.marketcetera.web.events.NewWindowEvent#getViewFactoryType() - */ - @Override - public Class getViewFactoryType() - { - return OrderTicketViewFactory.class; - } /* (non-Javadoc) * @see org.marketcetera.web.events.NewWindowEvent#getProperties() */ @@ -58,15 +47,6 @@ public Properties getProperties() { return windowProperties; } - /* (non-Javadoc) - * @see org.marketcetera.ui.events.NewWindowEvent#getWindowSize() - */ - @Override - public Pair getWindowSize() - { - return Pair.create(850.0, - 200.0); - } /** * Create a new ReplaceOrderEvent instance. * diff --git a/photon/src/main/java/org/marketcetera/ui/marketdata/event/MarketDataSuggestionEvent.java b/photon/src/main/java/org/marketcetera/ui/trade/event/SuggestionEvent.java similarity index 59% rename from photon/src/main/java/org/marketcetera/ui/marketdata/event/MarketDataSuggestionEvent.java rename to photon/src/main/java/org/marketcetera/ui/trade/event/SuggestionEvent.java index 9f4e0a4dae..ca1ff50c1f 100644 --- a/photon/src/main/java/org/marketcetera/ui/marketdata/event/MarketDataSuggestionEvent.java +++ b/photon/src/main/java/org/marketcetera/ui/trade/event/SuggestionEvent.java @@ -1,21 +1,25 @@ -package org.marketcetera.ui.marketdata.event; +package org.marketcetera.ui.trade.event; import org.marketcetera.trade.HasSuggestion; import org.marketcetera.trade.Suggestion; import org.marketcetera.ui.events.NewWindowEvent; -import org.marketcetera.ui.trade.view.orderticket.OrderTicketViewFactory; -import org.marketcetera.ui.view.ContentViewFactory; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; /* $License$ */ /** - * Indicates that a trade suggestion has been triggered from market data. + * Indicates that a trade suggestion has been triggered. * * @author Colin DuPlantis * @version $Id$ * @since $Release$ */ -public class MarketDataSuggestionEvent +@Component +@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) +public class SuggestionEvent + extends AbstractOrderTicketEvent implements NewWindowEvent,HasSuggestion { /* (non-Javadoc) @@ -34,22 +38,14 @@ public String getWindowTitle() { return title; } - /* (non-Javadoc) - * @see org.marketcetera.web.events.NewWindowEvent#getViewFactoryType() - */ - @Override - public Class getViewFactoryType() - { - return OrderTicketViewFactory.class; - } /** - * Create a new MarketDataSuggestionEvent instance. + * Create a new SuggestionEvent instance. * * @param inTitle a String value * @param inSuggestion a Suggestion value */ - public MarketDataSuggestionEvent(String inTitle, - Suggestion inSuggestion) + public SuggestionEvent(String inTitle, + Suggestion inSuggestion) { title = inTitle; suggestion = inSuggestion; diff --git a/photon/src/main/java/org/marketcetera/ui/trade/event/TradeOrderEvent.java b/photon/src/main/java/org/marketcetera/ui/trade/event/TradeOrderEvent.java index 9bab66cc01..0ed7f55be7 100644 --- a/photon/src/main/java/org/marketcetera/ui/trade/event/TradeOrderEvent.java +++ b/photon/src/main/java/org/marketcetera/ui/trade/event/TradeOrderEvent.java @@ -4,8 +4,6 @@ import org.marketcetera.trade.AverageFillPrice; import org.marketcetera.trade.HasAverageFillPrice; -import org.marketcetera.ui.trade.view.orderticket.OrderTicketViewFactory; -import org.marketcetera.ui.view.ContentViewFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; @@ -41,14 +39,6 @@ public String getWindowTitle() { return "Trade " + averageFillPrice.getInstrumentAsString(); } - /* (non-Javadoc) - * @see org.marketcetera.web.events.NewWindowEvent#getViewFactoryType() - */ - @Override - public Class getViewFactoryType() - { - return OrderTicketViewFactory.class; - } /* (non-Javadoc) * @see org.marketcetera.web.events.NewWindowEvent#getProperties() */ diff --git a/photon/src/main/java/org/marketcetera/ui/trade/fixmessagedetails/view/FixMessageDetailsView.java b/photon/src/main/java/org/marketcetera/ui/trade/fixmessagedetails/view/FixMessageDetailsView.java index e4fd8758f9..80ed59cb13 100644 --- a/photon/src/main/java/org/marketcetera/ui/trade/fixmessagedetails/view/FixMessageDetailsView.java +++ b/photon/src/main/java/org/marketcetera/ui/trade/fixmessagedetails/view/FixMessageDetailsView.java @@ -63,8 +63,8 @@ public Region getMainLayout() /** * Create a new FixMessageDetailsView instance. * - * @param inParentWindow a Region value - * @param inNewWindowEvent a NewWindowEvent value + * @param inParent a Region value + * @param inEvent a NewWindowEvent value * @param inViewProperties a Properties value */ public FixMessageDetailsView(Region inParent, diff --git a/photon/src/main/java/org/marketcetera/ui/trade/fixmessagedetails/view/FixMessageDetailsViewFactory.java b/photon/src/main/java/org/marketcetera/ui/trade/fixmessagedetails/view/FixMessageDetailsViewFactory.java index 695472503e..1107bd6c4e 100644 --- a/photon/src/main/java/org/marketcetera/ui/trade/fixmessagedetails/view/FixMessageDetailsViewFactory.java +++ b/photon/src/main/java/org/marketcetera/ui/trade/fixmessagedetails/view/FixMessageDetailsViewFactory.java @@ -7,7 +7,7 @@ /* $License$ */ /** - * Creates {@link OpenOrderView} content objects. + * Creates {@link FixMessageDetailsView} content objects. * * @author Colin DuPlantis * @version $Id$ diff --git a/photon/src/main/java/org/marketcetera/ui/trade/view/AbstractDeletableFixMessageView.java b/photon/src/main/java/org/marketcetera/ui/trade/view/AbstractDeletableFixMessageView.java index 7024523c04..15b5b30464 100644 --- a/photon/src/main/java/org/marketcetera/ui/trade/view/AbstractDeletableFixMessageView.java +++ b/photon/src/main/java/org/marketcetera/ui/trade/view/AbstractDeletableFixMessageView.java @@ -36,7 +36,7 @@ public abstract class AbstractDeletableFixMessageViewRegion
value - * @param inNewWindowEvent a NewWindowEvent value + * @param inEvent a NewWindowEvent value * @param inViewProperties a Properties value */ protected AbstractDeletableFixMessageView(Region inParentWindow, diff --git a/photon/src/main/java/org/marketcetera/ui/trade/view/AbstractFixMessageView.java b/photon/src/main/java/org/marketcetera/ui/trade/view/AbstractFixMessageView.java index da98ce00cd..1055800d8a 100644 --- a/photon/src/main/java/org/marketcetera/ui/trade/view/AbstractFixMessageView.java +++ b/photon/src/main/java/org/marketcetera/ui/trade/view/AbstractFixMessageView.java @@ -745,7 +745,7 @@ protected Node getPlaceholder() * Create a new AbstractFixMessageView instance. * * @param inParentWindow a Region value - * @param inNewWindowEvent a NewWindowEvent value + * @param inEvent a NewWindowEvent value * @param inViewProperties a Properties value */ protected AbstractFixMessageView(Region inParentWindow, diff --git a/photon/src/main/java/org/marketcetera/ui/trade/view/AbstractTradeViewFactory.java b/photon/src/main/java/org/marketcetera/ui/trade/view/AbstractTradeViewFactory.java index 7fcbc9587f..97f0a80bf0 100644 --- a/photon/src/main/java/org/marketcetera/ui/trade/view/AbstractTradeViewFactory.java +++ b/photon/src/main/java/org/marketcetera/ui/trade/view/AbstractTradeViewFactory.java @@ -139,6 +139,10 @@ protected Image getIcon(String inName) * weight of order ticket menu item */ protected static final int orderTicketWeight = 500; + /** + * weight of trade suggestions menu item + */ + protected static final int tradeSuggestionsWeight = 600; /** * provides access to web message services */ diff --git a/photon/src/main/java/org/marketcetera/ui/trade/view/averageprice/AveragePriceView.java b/photon/src/main/java/org/marketcetera/ui/trade/view/averageprice/AveragePriceView.java index 89e8d9314f..b2c61744a5 100644 --- a/photon/src/main/java/org/marketcetera/ui/trade/view/averageprice/AveragePriceView.java +++ b/photon/src/main/java/org/marketcetera/ui/trade/view/averageprice/AveragePriceView.java @@ -31,7 +31,7 @@ public class AveragePriceView * Create a new AveragePriceView instance. * * @param inParentWindow a Region value - * @param inNewWindowEvent a NewWindowEvent value + * @param inEvent a NewWindowEvent value * @param inViewProperties a Properties value */ public AveragePriceView(Region inParentWindow, diff --git a/photon/src/main/java/org/marketcetera/ui/trade/view/averageprice/AveragePriceViewFactory.java b/photon/src/main/java/org/marketcetera/ui/trade/view/averageprice/AveragePriceViewFactory.java index 382a618519..2f80588935 100644 --- a/photon/src/main/java/org/marketcetera/ui/trade/view/averageprice/AveragePriceViewFactory.java +++ b/photon/src/main/java/org/marketcetera/ui/trade/view/averageprice/AveragePriceViewFactory.java @@ -81,15 +81,6 @@ protected Class getViewFactoryType() { return AveragePriceViewFactory.class; } -// /* (non-Javadoc) -// * @see org.marketcetera.web.trade.openorders.view.AbstractTradeViewFactory#getWindowSize() -// */ -// @Override -// protected Pair getWindowSize() -// { -// return Pair.create(800.0, -// 200.0); -// } /** * permission(s) required to execute average price view */ diff --git a/photon/src/main/java/org/marketcetera/ui/trade/view/fills/FillsView.java b/photon/src/main/java/org/marketcetera/ui/trade/view/fills/FillsView.java index ec131dd2e4..3dc791aaf2 100644 --- a/photon/src/main/java/org/marketcetera/ui/trade/view/fills/FillsView.java +++ b/photon/src/main/java/org/marketcetera/ui/trade/view/fills/FillsView.java @@ -31,7 +31,7 @@ public class FillsView * Create a new FillsView instance. * * @param inParentWindow a Region value - * @param inNewWindowEvent a NewWindowEvent value + * @param inEvent a NewWindowEvent value * @param inViewProperties a Properties value */ public FillsView(Region inParentWindow, diff --git a/photon/src/main/java/org/marketcetera/ui/trade/view/openorders/OpenOrderView.java b/photon/src/main/java/org/marketcetera/ui/trade/view/openorders/OpenOrderView.java index adb7487879..be3690bcf2 100644 --- a/photon/src/main/java/org/marketcetera/ui/trade/view/openorders/OpenOrderView.java +++ b/photon/src/main/java/org/marketcetera/ui/trade/view/openorders/OpenOrderView.java @@ -55,7 +55,7 @@ public String getViewName() * Create a new OpenOrderView instance. * * @param inParentWindow a Region value - * @param inNewWindowEvent a NewWindowEvent value + * @param inEvent a NewWindowEvent value * @param inViewProperties a Properties value */ public OpenOrderView(Region inParentWindow, diff --git a/photon/src/main/java/org/marketcetera/ui/trade/view/orderticket/OrderTicketView.java b/photon/src/main/java/org/marketcetera/ui/trade/view/orderticket/OrderTicketView.java index 1897a81871..5458ab3c22 100644 --- a/photon/src/main/java/org/marketcetera/ui/trade/view/orderticket/OrderTicketView.java +++ b/photon/src/main/java/org/marketcetera/ui/trade/view/orderticket/OrderTicketView.java @@ -650,9 +650,9 @@ public void handle(MouseEvent inEvent) "{} failed validation: {}", newOrder, errorMessage); - // TODO -// Notification.show("Unable to submit: " + errorMessage, -// Type.ERROR_MESSAGE); + uiMessageService.post(new NotificationEvent("Submit Order Failed", + "Unable to submit order: " + errorMessage, + AlertType.ERROR)); sendButton.requestFocus(); return; } @@ -662,13 +662,15 @@ public void handle(MouseEvent inEvent) newOrder); SendOrderResponse response = serviceManager.getService(TradeClientService.class).send(newOrder); if(response.getFailed()) { -// Notification.show("Unable to submit: " + response.getOrderId() + " " + response.getMessage(), -// Type.ERROR_MESSAGE); + uiMessageService.post(new NotificationEvent("Submit Order Failed", + "Unable to submit: " + response.getOrderId() + " " + response.getMessage(), + AlertType.ERROR)); sendButton.requestFocus(); return; } else { -// Notification.show(response.getOrderId() + " submitted", -// Type.TRAY_NOTIFICATION); + uiMessageService.post(new NotificationEvent("Submit Order Succeeded", + response.getOrderId() + " submitted", + AlertType.INFORMATION)); if(replaceExecutionReportOption.isPresent()) { // close containing ticket // TODO need to trigger a close action @@ -679,6 +681,7 @@ public void handle(MouseEvent inEvent) } } }); + clearButton.setOnAction(event -> resetTicket(true)); orderTicketLayout.setVgap(5); orderTicketLayout.setHgap(5); int rowCount = 0; @@ -712,7 +715,7 @@ public void handle(MouseEvent inEvent) * Create a new OrderTicketView instance. * * @param inParent a Region value - * @param inNewWindowEvent a NewWindowEvent value + * @param inEvent a NewWindowEvent value * @param inProperties a Properties value */ public OrderTicketView(Region inParent, @@ -999,7 +1002,7 @@ private void adjustSendButton() private void resetTicket(boolean inCompletelyReset) { SLF4JLoggerProxy.debug(this, - "Clearing order ticket"); + "Clearing order ticket"); // this one is always cleared (to prevent accidentally submitting the same order twice) quantityTextField.clear(); if(inCompletelyReset) { diff --git a/photon/src/main/java/org/marketcetera/ui/trade/view/reports/ReportsView.java b/photon/src/main/java/org/marketcetera/ui/trade/view/reports/ReportsView.java index 6eda272006..82c8372daf 100644 --- a/photon/src/main/java/org/marketcetera/ui/trade/view/reports/ReportsView.java +++ b/photon/src/main/java/org/marketcetera/ui/trade/view/reports/ReportsView.java @@ -38,7 +38,7 @@ public class ReportsView * Create a new ReportsView instance. * * @param inParentWindow a Region value - * @param inNewWindowEvent a NewWindowEvent value + * @param inEvent a NewWindowEvent value * @param inViewProperties a Properties value */ public ReportsView(Region inParentWindow, diff --git a/photon/src/main/java/org/marketcetera/ui/trade/view/suggestions/DisplaySuggestion.java b/photon/src/main/java/org/marketcetera/ui/trade/view/suggestions/DisplaySuggestion.java new file mode 100644 index 0000000000..84dee2d118 --- /dev/null +++ b/photon/src/main/java/org/marketcetera/ui/trade/view/suggestions/DisplaySuggestion.java @@ -0,0 +1,195 @@ +package org.marketcetera.ui.trade.view.suggestions; + +import java.math.BigDecimal; +import java.util.Date; + +import org.marketcetera.trade.HasInstrument; +import org.marketcetera.trade.Instrument; +import org.marketcetera.trade.OrderSingleSuggestion; +import org.marketcetera.trade.OrderType; +import org.marketcetera.trade.Side; +import org.marketcetera.trade.Suggestion; + +import javafx.beans.property.ObjectProperty; +import javafx.beans.property.ReadOnlyObjectProperty; +import javafx.beans.property.ReadOnlyStringProperty; +import javafx.beans.property.SimpleObjectProperty; +import javafx.beans.property.SimpleStringProperty; +import javafx.beans.property.StringProperty; + +/* $License$ */ + +/** + * Provides a display-oriented {@link Suggestion} implementation. + * + * @author Colin DuPlantis + * @version $Id$ + * @since $Release$ + */ +public class DisplaySuggestion + implements HasInstrument +{ + /** + * Create a new DisplaySuggestion instance. + * + * @param inSuggestion a Suggestion value + */ + public DisplaySuggestion(Suggestion inSuggestion) + { + sourceProperty.set(inSuggestion); + identifierProperty.set(inSuggestion.getIdentifier()); + scoreProperty.set(inSuggestion.getScore()); + if(inSuggestion instanceof OrderSingleSuggestion) { + OrderSingleSuggestion orderSingleSuggestion = (OrderSingleSuggestion)inSuggestion; + instrumentProperty.set(orderSingleSuggestion.getOrder().getInstrument()); + orderTypeProperty.set(orderSingleSuggestion.getOrder().getOrderType()); + priceProperty.set(orderSingleSuggestion.getOrder().getPrice()); + quantityProperty.set(orderSingleSuggestion.getOrder().getQuantity()); + sideProperty.set(orderSingleSuggestion.getOrder().getSide()); + timestampProperty.set(new Date()); // TODO should be the timestamp from the suggestion, probably + } else { + throw new UnsupportedOperationException("Unsupported suggestion type: " + inSuggestion.getClass().getSimpleName()); + } + } + /* (non-Javadoc) + * @see org.marketcetera.trade.HasInstrument#getInstrument() + */ + @Override + public Instrument getInstrument() + { + return instrumentProperty.get(); + } + /* (non-Javadoc) + * @see org.marketcetera.trade.HasInstrument#setInstrument(org.marketcetera.trade.Instrument) + */ + @Override + public void setInstrument(Instrument inInstrument) + { + instrumentProperty.set(inInstrument); + } + /** + * Get the identifierProperty value. + * + * @return a ReadOnlyStringProperty value + */ + public ReadOnlyStringProperty identifierProperty() + { + return identifierProperty; + } + /** + * Get the scoreProperty value. + * + * @return a ReadOnlyObjectProperty<BigDecimal> value + */ + public ReadOnlyObjectProperty scoreProperty() + { + return scoreProperty; + } + /** + * Get the sideProperty value. + * + * @return a ReadOnlyObjectProperty<Side> value + */ + public ReadOnlyObjectProperty sideProperty() + { + return sideProperty; + } + /** + * Get the quantityProperty value. + * + * @return a ReadOnlyObjectProperty<BigDecimal> value + */ + public ReadOnlyObjectProperty quantityProperty() + { + return quantityProperty; + } + /** + * Get the priceProperty value. + * + * @return a ReadOnlyObjectProperty<BigDecimal> value + */ + public ReadOnlyObjectProperty priceProperty() + { + return priceProperty; + } + /** + * Get the instrumentProperty value. + * + * @return a ReadOnlyObjectProperty<Instrument> value + */ + public ReadOnlyObjectProperty instrumentProperty() + { + return instrumentProperty; + } + /** + * Get the orderTypeProperty value. + * + * @return a ReadOnlyObjectProperty<OrderType> value + */ + public ReadOnlyObjectProperty orderTypeProperty() + { + return orderTypeProperty; + } + /** + * Get the timestampProperty value. + * + * @return a ReadOnlyObjectProperty<Date> value + */ + public ReadOnlyObjectProperty timestampProperty() + { + return timestampProperty; + } + /** + * Get the sourceProperty value. + * + * @return a ReadOnlyObjectProperty<Suggestion> value + */ + public ReadOnlyObjectProperty sourceProperty() + { + return sourceProperty; + } + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() + { + return sourceProperty.get().toString(); + } + /** + * identifier property value + */ + private final StringProperty identifierProperty = new SimpleStringProperty(); + /** + * score property value + */ + private final ObjectProperty scoreProperty = new SimpleObjectProperty<>(); + /** + * side property value + */ + private final ObjectProperty sideProperty = new SimpleObjectProperty<>(); + /** + * quantity property value + */ + private final ObjectProperty quantityProperty = new SimpleObjectProperty<>(); + /** + * price property value + */ + private final ObjectProperty priceProperty = new SimpleObjectProperty<>(); + /** + * instrument property value + */ + private final ObjectProperty instrumentProperty = new SimpleObjectProperty<>(); + /** + * order type property value + */ + private final ObjectProperty orderTypeProperty = new SimpleObjectProperty<>(); + /** + * timestamp property value + */ + private final ObjectProperty timestampProperty = new SimpleObjectProperty<>(); + /** + * original source suggestion property value + */ + private final ObjectProperty sourceProperty = new SimpleObjectProperty<>(); +} diff --git a/photon/src/main/java/org/marketcetera/ui/trade/view/suggestions/SuggestionsView.java b/photon/src/main/java/org/marketcetera/ui/trade/view/suggestions/SuggestionsView.java new file mode 100644 index 0000000000..12d4d970c7 --- /dev/null +++ b/photon/src/main/java/org/marketcetera/ui/trade/view/suggestions/SuggestionsView.java @@ -0,0 +1,464 @@ +package org.marketcetera.ui.trade.view.suggestions; + +import java.math.BigDecimal; +import java.util.Collection; +import java.util.Date; +import java.util.Properties; + +import org.marketcetera.core.BigDecimalUtil; +import org.marketcetera.core.PlatformServices; +import org.marketcetera.trade.Instrument; +import org.marketcetera.trade.OrderType; +import org.marketcetera.trade.Side; +import org.marketcetera.trade.Suggestion; +import org.marketcetera.trade.SuggestionListener; +import org.marketcetera.trade.TradePermissions; +import org.marketcetera.ui.PhotonServices; +import org.marketcetera.ui.events.NewWindowEvent; +import org.marketcetera.ui.service.trade.TradeClientService; +import org.marketcetera.ui.trade.event.SuggestionEvent; +import org.marketcetera.ui.view.AbstractContentView; +import org.marketcetera.util.log.SLF4JLoggerProxy; +import org.nocrala.tools.texttablefmt.BorderStyle; +import org.nocrala.tools.texttablefmt.ShownBorders; +import org.nocrala.tools.texttablefmt.Table; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + +import javafx.application.Platform; +import javafx.beans.value.ChangeListener; +import javafx.scene.control.ContextMenu; +import javafx.scene.control.Label; +import javafx.scene.control.MenuItem; +import javafx.scene.control.SelectionMode; +import javafx.scene.control.SeparatorMenuItem; +import javafx.scene.control.TableCell; +import javafx.scene.control.TableColumn; +import javafx.scene.control.TableView; +import javafx.scene.control.cell.PropertyValueFactory; +import javafx.scene.input.Clipboard; +import javafx.scene.input.ClipboardContent; +import javafx.scene.layout.Region; +import javafx.scene.layout.VBox; + +/* $License$ */ + +/** + * Displays trade suggestions. + * + * @author Colin DuPlantis + * @version $Id$ + * @since $Release$ + */ +@Component +@AutoConfiguration +@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) +public class SuggestionsView + extends AbstractContentView +{ + /* (non-Javadoc) + * @see org.marketcetera.ui.view.AbstractContentView#onStart() + */ + @Override + protected void onStart() + { + tradeClient = serviceManager.getService(TradeClientService.class); + mainLayout = new VBox(10); + initializeSuggestionTable(); + mainLayout.getChildren().add(suggestionTable); + suggestionTable.prefWidthProperty().bind(mainLayout.widthProperty()); + suggestionTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); + initializeSuggestionListener(); + } + /* (non-Javadoc) + * @see org.marketcetera.ui.view.ContentView#onClose() + */ + @Override + public void onClose() + { + if(suggestionListener != null) { + try { + tradeClient.removeSuggestionListener(suggestionListener); + suggestionListener = null; + } catch (Exception ignored) {} + } + super.onClose(); + } + /* (non-Javadoc) + * @see org.marketcetera.ui.view.ContentView#getMainLayout() + */ + @Override + public Region getMainLayout() + { + return mainLayout; + } + /* (non-Javadoc) + * @see org.marketcetera.ui.view.ContentView#getViewName() + */ + @Override + public String getViewName() + { + return NAME; + } + /* (non-Javadoc) + * @see org.marketcetera.ui.view.AbstractContentView#onClientConnect() + */ + @Override + protected void onClientConnect() + { + updateSuggestions(); + initializeSuggestionListener(); + } + /* (non-Javadoc) + * @see org.marketcetera.ui.view.AbstractContentView#onClientDisconnect() + */ + @Override + protected void onClientDisconnect() + { + Platform.runLater(() -> { + suggestionTable.getItems().clear(); + }); + } + /** + * Create a new SuggestionsView instance. + * + * @param inParent a Region value + * @param inEvent a NewWindowEvent value + * @param inProperties a Properties value + */ + public SuggestionsView(Region inParent, + NewWindowEvent inEvent, + Properties inProperties) + { + super(inParent, + inEvent, + inProperties); + } + /** + * Set up the strategy event listener. + */ + private void initializeSuggestionListener() + { + if(suggestionListener != null) { + try { + tradeClient.removeSuggestionListener(suggestionListener); + suggestionListener = null; + } catch (Exception ignored) {} + } + suggestionListener = new SuggestionListener() { + @Override + public void receiveSuggestion(Suggestion inSuggestion) + { + SLF4JLoggerProxy.trace(SuggestionsView.this, + "Received {}", + inSuggestion); + suggestionTable.getItems().add(new DisplaySuggestion(inSuggestion)); + } + }; + tradeClient.addSuggestionListener(suggestionListener); + } + /** + * Update the strategies table. + */ + private void updateSuggestions() + { + // TODO nothing really to do right now because the suggestions are not persisted - see MATP-1159 +// Platform.runLater(() -> { +// }); + } + /** + * Initialize the strategy table. + */ + private void initializeSuggestionTable() + { + suggestionTable = new TableView<>(); + suggestionTable.setPlaceholder(new Label("no suggestions")); + initializeSuggestionTableColumns(); + initializeSuggestionContextMenu(); + suggestionTable.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); + } + /** + * Render the given column as an Instrument cell. + * + * @param inTableColumn a TableColumn<DisplaySuggestion,Instrument> value + * @return a TableCell<DisplaySuggestion,Instrument> value + */ + public static TableCell renderInstrumentCell(TableColumn inTableColumn) + { + TableCell tableCell = new TableCell<>() { + @Override + protected void updateItem(Instrument inItem, + boolean isEmpty) + { + super.updateItem(inItem, + isEmpty); + this.setText(null); + this.setGraphic(null); + if(!isEmpty && inItem != null){ + this.setText(inItem.getFullSymbol()); + } + } + }; + return tableCell; + } + /** + * Initialize the strategy table columns. + */ + private void initializeSuggestionTableColumns() + { + identifierColumn = new TableColumn<>("Identifier"); + identifierColumn.setCellValueFactory(new PropertyValueFactory<>("identifier")); + scoreColumn = new TableColumn<>("Score"); + scoreColumn.setCellValueFactory(new PropertyValueFactory<>("score")); + scoreColumn.setCellFactory(tableColumn -> PhotonServices.renderNumberCell(tableColumn, + 4, + 4)); + quantityColumn = new TableColumn<>("Quantity"); + quantityColumn.setCellValueFactory(new PropertyValueFactory<>("quantity")); + quantityColumn.setCellFactory(tableColumn -> PhotonServices.renderNumberCell(tableColumn)); + sideColumn = new TableColumn<>("Side"); + sideColumn.setCellValueFactory(new PropertyValueFactory<>("side")); + quantityColumn = new TableColumn<>("Quantity"); + quantityColumn.setCellValueFactory(new PropertyValueFactory<>("quantity")); + quantityColumn.setCellFactory(tableColumn -> PhotonServices.renderNumberCell(tableColumn)); + instrumentColumn = new TableColumn<>("Instrument"); + instrumentColumn.setCellValueFactory(new PropertyValueFactory<>("instrument")); + instrumentColumn.setCellFactory(tableColumn -> renderInstrumentCell(tableColumn)); + priceColumn = new TableColumn<>("Price"); + priceColumn.setCellValueFactory(new PropertyValueFactory<>("price")); + priceColumn.setCellFactory(tableColumn -> PhotonServices.renderCurrencyCell(tableColumn)); + orderTypeColumn = new TableColumn<>("Order Type"); + orderTypeColumn.setCellValueFactory(new PropertyValueFactory<>("orderType")); + timestampColumn = new TableColumn<>("Timestamp"); + timestampColumn.setCellValueFactory(new PropertyValueFactory<>("timestamp")); + timestampColumn.setCellFactory(tableColumn -> PhotonServices.renderDateCell(tableColumn)); + suggestionTable.getColumns().add(identifierColumn); + suggestionTable.getColumns().add(scoreColumn); + suggestionTable.getColumns().add(sideColumn); + suggestionTable.getColumns().add(instrumentColumn); + suggestionTable.getColumns().add(quantityColumn); + suggestionTable.getColumns().add(priceColumn); + suggestionTable.getColumns().add(orderTypeColumn); + suggestionTable.getColumns().add(timestampColumn); + } + /** + * Enable or disable context menu items based on the given selected row items. + * + * @param inSelectedItems a Collection<DisplaySuggestion> value + */ + protected void enableContextMenuItems(Collection inSelectedItems) + { + if(inSelectedItems == null || inSelectedItems.isEmpty()) { + executeMenuItem.setDisable(true); + deleteMenuItem.setDisable(true); + return; + } + // any suggestion can be executed or deleted, assuming appropriate permissions + executeMenuItem.setDisable(!authzHelperService.hasPermission(TradePermissions.SendOrderAction)); + deleteMenuItem.setDisable(false); + } + /** + * Get the selected suggestions. + * + * @return a Collection<DisplaySuggestion> value + */ + private Collection getSelectedSuggestions() + { + return suggestionTable.getSelectionModel().getSelectedItems(); + } + /** + * Initialize the strategy context menu. + */ + private void initializeSuggestionContextMenu() + { + executeMenuItem = new MenuItem("Execute"); + executeMenuItem.setOnAction(event -> { + Collection selectedItems = getSelectedSuggestions(); + if(selectedItems == null || selectedItems.isEmpty()) { + return; + } + doExecute(selectedItems); + }); + deleteMenuItem = new MenuItem("Delete"); + deleteMenuItem.setOnAction(event -> { + Collection selectedItems = getSelectedSuggestions(); + if(selectedItems == null || selectedItems.isEmpty()) { + return; + } + doDelete(selectedItems); + }); + copyMenuItem = new MenuItem("Copy"); + copyMenuItem.setOnAction(event -> { + Collection selectedItems = getSelectedSuggestions(); + if(selectedItems == null || selectedItems.isEmpty()) { + return; + } + doCopy(selectedItems); + }); + suggestionContextMenu = new ContextMenu(); + suggestionContextMenu.getItems().addAll(executeMenuItem, + deleteMenuItem, + new SeparatorMenuItem(), + copyMenuItem); + suggestionTable.setContextMenu(suggestionContextMenu); + suggestionTable.getSelectionModel().selectedItemProperty().addListener((ChangeListener) (inObservable,inOldValue,inNewValue) -> { + enableContextMenuItems(getSelectedSuggestions()); + }); + } + /** + * Perform the execute operation on the given suggestions. + * + * @param inSuggestions a Collection<DisplaySuggestion> value + */ + private void doExecute(Collection inSuggestions) + { + for(DisplaySuggestion displaySuggestion : inSuggestions) { + uiMessageService.post(applicationContext.getBean(SuggestionEvent.class, + displaySuggestion.sideProperty().get().name() + " " + displaySuggestion.instrumentProperty().get().getFullSymbol(), + displaySuggestion.sourceProperty().get())); + } + } + /** + * Perform the delete operation on the given suggestions. + * + * @param inSuggestions a Collection<DisplaySuggestion> value + */ + private void doDelete(Collection inSuggestions) + { + suggestionTable.getItems().removeAll(inSuggestions); + } + /** + * Perform the copy operation on the given suggestions. + * + * @param inSuggestions a Collection<DisplaySuggestion> value + */ + private void doCopy(Collection inSuggestions) + { + Clipboard clipboard = Clipboard.getSystemClipboard(); + ClipboardContent clipboardContent = new ClipboardContent(); + clipboardContent.putString(renderSuggestions(inSuggestions)); + clipboard.setContent(clipboardContent); + } + /** + * Create a human-readable representation of the given suggestions. + * + * @param inSuggestions a Collection<DisplaySuggestion> value + * @return a String value + */ + private String renderSuggestions(Collection inSuggestions) + { + Table table = new Table(8, + BorderStyle.CLASSIC_COMPATIBLE_WIDE, + ShownBorders.ALL, + false); + table.addCell("Trade Suggestions", + PlatformServices.cellStyle, + 8); + table.addCell("Identifier", + PlatformServices.cellStyle); + table.addCell("Score", + PlatformServices.cellStyle); + table.addCell("Side", + PlatformServices.cellStyle); + table.addCell("Instrument", + PlatformServices.cellStyle); + table.addCell("Quantity", + PlatformServices.cellStyle); + table.addCell("Price", + PlatformServices.cellStyle); + table.addCell("Order Type", + PlatformServices.cellStyle); + table.addCell("Timestamp", + PlatformServices.cellStyle); + for(DisplaySuggestion suggestion : inSuggestions) { + table.addCell(suggestion.identifierProperty().get()); + table.addCell(BigDecimalUtil.renderDecimal(suggestion.scoreProperty().get(),4,4)); + table.addCell(suggestion.sideProperty().get().name()); + table.addCell(suggestion.instrumentProperty().get().getFullSymbol()); + table.addCell(BigDecimalUtil.render(suggestion.quantityProperty().get())); + table.addCell(BigDecimalUtil.renderCurrency(suggestion.priceProperty().get())); + table.addCell(suggestion.orderTypeProperty().get().name()); + table.addCell(String.valueOf(suggestion.timestampProperty().get())); + } + return table.render(); + } + /** + * provides access to the application context + */ + @Autowired + private ApplicationContext applicationContext; + /** + * identifier column + */ + private TableColumn identifierColumn; + /** + * side column + */ + private TableColumn sideColumn; + /** + * quantity column + */ + private TableColumn quantityColumn; + /** + * price column + */ + private TableColumn priceColumn; + /** + * score column + */ + private TableColumn scoreColumn; + /** + * instrument column + */ + private TableColumn instrumentColumn; + /** + * order type column + */ + private TableColumn orderTypeColumn; + /** + * timestamp column + */ + private TableColumn timestampColumn; + // TODO suggestion type column? + // TODO suggestion owner column? + /** + * context menu for the suggestion table + */ + private ContextMenu suggestionContextMenu; + /** + * execute menu item for the suggestion table + */ + private MenuItem executeMenuItem; + /** + * delete menu item for the suggestion table + */ + private MenuItem deleteMenuItem; + /** + * copy menu item for the suggestion table + */ + private MenuItem copyMenuItem; + /** + * listens for suggestions + */ + private SuggestionListener suggestionListener; + /** + * main view layout + */ + private VBox mainLayout; + /** + * strategy table + */ + private TableView suggestionTable; + /** + * provides access to trade services + */ + private TradeClientService tradeClient; + /** + * global name of the view + */ + private static final String NAME = "Suggestions View"; +} diff --git a/photon/src/main/java/org/marketcetera/ui/trade/view/suggestions/SuggestionsViewFactory.java b/photon/src/main/java/org/marketcetera/ui/trade/view/suggestions/SuggestionsViewFactory.java new file mode 100644 index 0000000000..d1bbb43026 --- /dev/null +++ b/photon/src/main/java/org/marketcetera/ui/trade/view/suggestions/SuggestionsViewFactory.java @@ -0,0 +1,90 @@ +package org.marketcetera.ui.trade.view.suggestions; + +import java.net.URL; +import java.util.Collections; +import java.util.Set; + +import org.marketcetera.trade.TradePermissions; +import org.marketcetera.ui.trade.view.AbstractTradeViewFactory; +import org.marketcetera.ui.view.ContentView; +import org.marketcetera.ui.view.MenuContent; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.stereotype.Component; + +import com.google.common.collect.Sets; + +/* $License$ */ + +/** + * Creates new {@link SuggestionsView} objects. + * + * @author Colin DuPlantis + * @version $Id$ + * @since $Release$ + */ +@Component +public class SuggestionsViewFactory + extends AbstractTradeViewFactory + implements MenuContent +{ + /* (non-Javadoc) + * @see org.marketcetera.ui.trade.view.AbstractTradeViewFactory#getViewFactoryType() + */ + @Override + protected Class getViewFactoryType() + { + return SuggestionsViewFactory.class; + } + /* (non-Javadoc) + * @see org.marketcetera.ui.trade.view.AbstractTradeViewFactory#getViewName() + */ + @Override + protected String getViewName() + { + return getMenuCaption(); + } + /* (non-Javadoc) + * @see org.marketcetera.ui.view.MenuContent#getMenuCaption() + */ + @Override + public String getMenuCaption() + { + return "Trade Suggestions"; + } + /* (non-Javadoc) + * @see org.marketcetera.ui.view.MenuContent#getWeight() + */ + @Override + public int getWeight() + { + return tradeSuggestionsWeight; + } + /* (non-Javadoc) + * @see org.marketcetera.ui.view.MenuContent#getMenuIcon() + */ + @Override + public URL getMenuIcon() + { + return getClass().getClassLoader().getResource("images/light-bulb.svg"); + } + /* (non-Javadoc) + * @see org.marketcetera.ui.view.AbstractContentViewFactory#getViewType() + */ + @Override + protected Class getViewType() + { + return SuggestionsView.class; + } + /* (non-Javadoc) + * @see org.marketcetera.web.view.MenuContent#getAllPermissions() + */ + @Override + public Set getAllPermissions() + { + return requiredPermissions; + } + /** + * permission(s) required to execute strategy session view + */ + private static final Set requiredPermissions = Collections.unmodifiableSet(Sets.newHashSet(TradePermissions.ViewSuggestionsAction)); +} diff --git a/photon/src/main/java/org/marketcetera/ui/view/AbstractContentView.java b/photon/src/main/java/org/marketcetera/ui/view/AbstractContentView.java index de7b9cf43f..4aba26e442 100644 --- a/photon/src/main/java/org/marketcetera/ui/view/AbstractContentView.java +++ b/photon/src/main/java/org/marketcetera/ui/view/AbstractContentView.java @@ -174,7 +174,7 @@ protected NewWindowEvent getNewWindowEvent() * Create a new AbstractContentView instance. * * @param inParentWindow a Region value - * @param inNewWindowEvent a NewWindowEvent value + * @param inEvent a NewWindowEvent value * @param inViewProperties a Properties value */ protected AbstractContentView(Region inParentWindow, diff --git a/photon/src/main/resources/images/light-bulb.svg b/photon/src/main/resources/images/light-bulb.svg new file mode 100644 index 0000000000..0e1fccec7f --- /dev/null +++ b/photon/src/main/resources/images/light-bulb.svg @@ -0,0 +1,5 @@ + + +light-bulb + + diff --git a/pom.xml b/pom.xml index 1a87edc717..c76e8bdc13 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ 11 - 2.7.9 + 2.7.10 3.2.1 2.17.1 -Xmx2048m -Xms128m @@ -429,9 +429,9 @@ - info.schnatterer.moby-names-generator - moby-names-generator - 20.10.0-r0 + info.schnatterer.moby-names-generator + moby-names-generator + 20.10.0-r0 org.flywaydb @@ -908,6 +908,25 @@ + + org.apache.maven.plugins + maven-project-info-reports-plugin + 3.4.3 + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.5.0 + + false + private + + + + org.apache.maven.plugins + maven-site-plugin + 3.12.1 + org.xolstice.maven.plugins protobuf-maven-plugin @@ -1055,7 +1074,7 @@ maven-surefire-plugin - 3.0.0-M5 + 3.0.0 false 2.5C @@ -1075,18 +1094,6 @@ ${mvn.javase.version} - - - maven-javadoc-plugin - 3.3.2 - - - false - - -Xdoclint:none - none - - maven-assembly-plugin @@ -1129,8 +1136,8 @@ kr.motd.maven os-maven-plugin 1.7.0 - - + + @@ -1151,6 +1158,12 @@ + + ide-build + + ${project.basedir}/target-ide + + release-sign-artifacts @@ -1175,29 +1188,6 @@ - - maven-javadoc-plugin - 3.3.2 - - - attach-javadocs - - jar - - - - - Marketcetera Platform ${project.version} API - Marketcetera Platform ${project.version} API - tools/javadoc/overview.html - - https://java.sun.com/javase/${mvn.javase.version}/docs/api/ - https://logging.apache.org/log4j/2.x/log4j-api/apidocs/ - https://docs.spring.io/spring/docs/4.3.8.RELEASE/javadoc-api/ - https://www.quickfixj.org/javadoc/1.6.3/ - - - @@ -1260,27 +1250,18 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.3.2 - org.umlgraph.doclet.UmlGraphDoc - - org.umlgraph - umlgraph - 5.6.6 - - -views -all - true + false + private org.apache.maven.plugins maven-site-plugin - 3.11.0 org.apache.maven.plugins maven-project-info-reports-plugin - 3.2.1 diff --git a/rpc-core/.gitignore b/rpc-core/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/rpc-core/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/rpc-core/src/main/java/org/marketcetera/rpc/client/AbstractContextAwareRpcClientParameters.java b/rpc-core/src/main/java/org/marketcetera/rpc/client/AbstractContextAwareRpcClientParameters.java index eb2a4ae0dd..7aff74a509 100644 --- a/rpc-core/src/main/java/org/marketcetera/rpc/client/AbstractContextAwareRpcClientParameters.java +++ b/rpc-core/src/main/java/org/marketcetera/rpc/client/AbstractContextAwareRpcClientParameters.java @@ -26,7 +26,7 @@ public ContextClassProvider getContextClassProvider() /** * Sets the contextClassProvider value. * - * @param a ContextClassProvider value + * @param inContextClassProvider a ContextClassProvider value */ public void setContextClassProvider(ContextClassProvider inContextClassProvider) { diff --git a/rpc-core/src/main/java/org/marketcetera/rpc/paging/PagingRpcUtil.java b/rpc-core/src/main/java/org/marketcetera/rpc/paging/PagingRpcUtil.java index d969ff7621..1de6a54a0a 100644 --- a/rpc-core/src/main/java/org/marketcetera/rpc/paging/PagingRpcUtil.java +++ b/rpc-core/src/main/java/org/marketcetera/rpc/paging/PagingRpcUtil.java @@ -95,7 +95,7 @@ public static PagingRpc.SortOrder getRpcSort(List inSortOrder) /** * Set the page response values on the given page response from the given RPC page response. * - * @param inPageRequest a ,code>PagingRpc.PageRequest
value + * @param inPageRequest a PagingRpc.PageRequest value * @param inPageResponse a PagingRpc.PageResponse value * @param inResults a CollectionPageResponse<Clazz> value */ diff --git a/rpc-core/src/main/java/org/marketcetera/rpc/server/AbstractRpcService.java b/rpc-core/src/main/java/org/marketcetera/rpc/server/AbstractRpcService.java index 4ab8fe7edb..da7b2b2824 100644 --- a/rpc-core/src/main/java/org/marketcetera/rpc/server/AbstractRpcService.java +++ b/rpc-core/src/main/java/org/marketcetera/rpc/server/AbstractRpcService.java @@ -88,7 +88,7 @@ public void setAuthenticator(Authenticator inAuthenticator) /** * Get the sessionManager value. * - * @return a SessionManager value + * @return a SessionManager<SessionClazz> value */ public SessionManager getSessionManager() { @@ -97,7 +97,7 @@ public SessionManager getSessionManager() /** * Sets the sessionManager value. * - * @param inSessionManager a SessionManager value + * @param inSessionManager a SessionManager<SessionClazz> value */ public void setSessionManager(SessionManager inSessionManager) { @@ -106,7 +106,7 @@ public void setSessionManager(SessionManager inSessionManager) /** * Get the description of the service. * - * @return a String value + * @return a String value */ protected abstract String getServiceDescription(); /** diff --git a/rpc-core/src/main/java/org/marketcetera/rpc/server/RpcServer.java b/rpc-core/src/main/java/org/marketcetera/rpc/server/RpcServer.java index 73ece61982..5852a903ca 100644 --- a/rpc-core/src/main/java/org/marketcetera/rpc/server/RpcServer.java +++ b/rpc-core/src/main/java/org/marketcetera/rpc/server/RpcServer.java @@ -201,7 +201,7 @@ public void setHostname(String inHostname) /** * Get the serverServiceDefinitions value. * - * @return a List value + * @return a List<BindableService> value */ public List getServerServiceDefinitions() { @@ -210,7 +210,7 @@ public List getServerServiceDefinitions() /** * Sets the serverServiceDefinitions value. * - * @param inServerServiceDefinitions a List value + * @param inServerServiceDefinitions a List<BindableService> value */ public void setServerServiceDefinitions(List inServerServiceDefinitions) { diff --git a/rpc-core/src/test/java/org/marketcetera/rpc/RpcTestBase.java b/rpc-core/src/test/java/org/marketcetera/rpc/RpcTestBase.java index 772abe74de..9c16fa7e05 100644 --- a/rpc-core/src/test/java/org/marketcetera/rpc/RpcTestBase.java +++ b/rpc-core/src/test/java/org/marketcetera/rpc/RpcTestBase.java @@ -288,7 +288,7 @@ public Boolean call() /** * Get a client factory instance. * - * @return a RpcClientFactory<RpcClientParametersClazz,RpcClientClazz&;gt; value + * @return a RpcClientFactory<RpcClientParametersClazz,RpcClientClazz> value */ protected abstract RpcClientFactory getRpcClientFactory(); /** @@ -324,7 +324,7 @@ protected abstract RpcClientParametersClazz getClientParameters(String inHostnam * @param inHostname a String value * @param inPort an int value * @param inUsername a String value - * @param inPassword a String value + * @param inPassword a String value * @return a RpcClientClazz value * @throws Exception if an unexpected error occurs */ diff --git a/strategy/strategy-api/.gitignore b/strategy/strategy-api/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/strategy/strategy-api/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/strategy/strategy-api/src/main/java/org/marketcetera/strategy/FileUploadRequest.java b/strategy/strategy-api/src/main/java/org/marketcetera/strategy/FileUploadRequest.java index 5c68f51d87..020f2a9520 100644 --- a/strategy/strategy-api/src/main/java/org/marketcetera/strategy/FileUploadRequest.java +++ b/strategy/strategy-api/src/main/java/org/marketcetera/strategy/FileUploadRequest.java @@ -5,7 +5,7 @@ /* $License$ */ /** - * + * Holds the information that tracks a strategy file upload process. * * @author Colin DuPlantis * @version $Id$ @@ -13,20 +13,46 @@ */ public interface FileUploadRequest { + /** + * Get the upload file path. + * + * @return a String value + */ String getFilePath(); + /** + * Get the human-readable strategy name. + * + * @return a String value + */ String getName(); + /** + * Get the one-time nonce for this strategy upload. + * + * @return a String value + */ String getNonce(); + /** + * Get the owner of this strategy. + * + * @return a User value + */ User getOwner(); - default void onProgress(double inPercentComplete) - { - - } - default void onStatus(FileUploadStatus inStatus) - { - - } - default void onError(Throwable inThrowable) - { - - } + /** + * Report percent complete in a range of [0..1]. + * + * @param inPercentComplete in a double value + */ + default void onProgress(double inPercentComplete) {} + /** + * Report changes in upload status. + * + * @param inStatus a FileUploadStatus value + */ + default void onStatus(FileUploadStatus inStatus) {} + /** + * Report errors that occur, if any, during the upload process. + * + * @param inThrowable a Throwable value + */ + default void onError(Throwable inThrowable) {} } diff --git a/strategy/strategy-api/src/main/java/org/marketcetera/strategy/StrategyClient.java b/strategy/strategy-api/src/main/java/org/marketcetera/strategy/StrategyClient.java index 17074536ac..8281858ad6 100644 --- a/strategy/strategy-api/src/main/java/org/marketcetera/strategy/StrategyClient.java +++ b/strategy/strategy-api/src/main/java/org/marketcetera/strategy/StrategyClient.java @@ -30,14 +30,14 @@ public interface StrategyClient /** * Requests loaded strategy instances. * - * @returns a Collection<? extends StrategyInstance> value + * @return a Collection<? extends StrategyInstance> value */ Collection getStrategyInstances(); /** * Load a new strategy instances. * * @param inStrategyInstance a StrategyInstance value - * @returns an StrategyStatus value + * @return an StrategyStatus value */ StrategyStatus loadStrategyInstance(StrategyInstance inStrategyInstance); /** @@ -46,7 +46,7 @@ public interface StrategyClient * @param inStrategyName a String value * @param inSeverity a Severity value * @param inPageRequest an PageRequest value - * @returns a CollectionPageResponse<? extends StrategyMessage> value + * @return a CollectionPageResponse<? extends StrategyMessage> value */ CollectionPageResponse getStrategyMessages(String inStrategyName, Severity inSeverity, @@ -55,7 +55,7 @@ CollectionPageResponse getStrategyMessages(String inS * Finds the strategy instance with the given name. * * @param inName a String value - * @returns an Optional<? extends StrategyInstance> value + * @return an Optional<? extends StrategyInstance> value */ Optional findByName(String inName); /** @@ -68,14 +68,25 @@ CollectionPageResponse getStrategyMessages(String inS void uploadFile(FileUploadRequest inRequest) throws IOException, NoSuchAlgorithmException; /** - * + * Cause a {@link StrategyMessage} to be created and emitted for the in-context strategy instance. * - * - * @param inSeverity - * @param inMessage + * @param inSeverity a Severity value + * @param inMessage a String value */ void emitMessage(Severity inSeverity, String inMessage); + /** + * Delete the strategy message with the given unique identifier. + * + * @param inStrategyMessageId a long value + */ + void deleteStrategyMessage(long inStrategyMessageId); + /** + * Delete all strategy messages for the given strategy instance. + * + * @param inStrategyInstanceName a String value + */ + void deleteAllStrategyMessages(String inStrategyInstanceName); /** * Start a strategy instance. * diff --git a/strategy/strategy-api/src/main/java/org/marketcetera/strategy/StrategyInstance.java b/strategy/strategy-api/src/main/java/org/marketcetera/strategy/StrategyInstance.java index 559af3046a..0c11fa3bb1 100644 --- a/strategy/strategy-api/src/main/java/org/marketcetera/strategy/StrategyInstance.java +++ b/strategy/strategy-api/src/main/java/org/marketcetera/strategy/StrategyInstance.java @@ -3,6 +3,11 @@ // package org.marketcetera.strategy; +import java.util.Date; + +import org.marketcetera.admin.HasCurrentUser; +import org.marketcetera.core.Preserve; + /* $License$ */ /** @@ -12,8 +17,9 @@ * @version $Id$ * @since $Release$ */ +@Preserve public interface StrategyInstance - extends org.marketcetera.admin.HasUser + extends HasCurrentUser { /** * Get the name value. @@ -66,25 +72,25 @@ public interface StrategyInstance /** * Get the started value. * - * @return a java.util.Date value + * @return a Date value */ - java.util.Date getStarted(); + Date getStarted(); /** * Set the started value. * - * @param inStarted a java.util.Date value + * @param inStarted a Date value */ - void setStarted(java.util.Date inStarted); + void setStarted(Date inStarted); /** * Get the status value. * - * @return an org.marketcetera.strategy.StrategyStatus value + * @return an StrategyStatus value */ - org.marketcetera.strategy.StrategyStatus getStatus(); + StrategyStatus getStatus(); /** * Set the status value. * - * @param inStatus an org.marketcetera.strategy.StrategyStatus value + * @param inStatus an StrategyStatus value */ - void setStatus(org.marketcetera.strategy.StrategyStatus inStatus); + void setStatus(StrategyStatus inStatus); } diff --git a/strategy/strategy-api/src/main/java/org/marketcetera/strategy/StrategyInstanceHolder.java b/strategy/strategy-api/src/main/java/org/marketcetera/strategy/StrategyInstanceHolder.java index 45162dce47..168534daca 100644 --- a/strategy/strategy-api/src/main/java/org/marketcetera/strategy/StrategyInstanceHolder.java +++ b/strategy/strategy-api/src/main/java/org/marketcetera/strategy/StrategyInstanceHolder.java @@ -3,7 +3,7 @@ /* $License$ */ /** - * + * Provides a strategy instance value. * * @author Colin DuPlantis * @version $Id$ @@ -11,5 +11,10 @@ */ public interface StrategyInstanceHolder { + /** + * Get the strategy instance value. + * + * @return a StrategyInstance value + */ StrategyInstance getStrategyInstance(); } diff --git a/strategy/strategy-api/src/main/java/org/marketcetera/strategy/StrategyMessage.java b/strategy/strategy-api/src/main/java/org/marketcetera/strategy/StrategyMessage.java index f0a3840226..f682e4e729 100644 --- a/strategy/strategy-api/src/main/java/org/marketcetera/strategy/StrategyMessage.java +++ b/strategy/strategy-api/src/main/java/org/marketcetera/strategy/StrategyMessage.java @@ -3,6 +3,11 @@ // package org.marketcetera.strategy; +import java.util.Date; + +import org.marketcetera.core.Preserve; +import org.marketcetera.core.notifications.INotification; + /* $License$ */ /** @@ -12,33 +17,40 @@ * @version $Id$ * @since $Release$ */ +@Preserve public interface StrategyMessage - extends org.marketcetera.strategy.HasStrategyInstance + extends HasStrategyInstance { + /** + * Get the strategy message unique identifier. + * + * @return a long value + */ + long getStrategyMessageId(); /** * Get the messageTimestamp value. * - * @return a java.util.Date value + * @return a Date value */ - java.util.Date getMessageTimestamp(); + Date getMessageTimestamp(); /** * Set the messageTimestamp value. * - * @param inMessageTimestamp a java.util.Date value + * @param inMessageTimestamp a Date value */ - void setMessageTimestamp(java.util.Date inMessageTimestamp); + void setMessageTimestamp(Date inMessageTimestamp); /** * Get the severity value. * - * @return an org.marketcetera.core.notifications.INotification.Severity value + * @return an INotification.Severity value */ - org.marketcetera.core.notifications.INotification.Severity getSeverity(); + INotification.Severity getSeverity(); /** * Set the severity value. * - * @param inSeverity an org.marketcetera.core.notifications.INotification.Severity value + * @param inSeverity an INotification.Severity value */ - void setSeverity(org.marketcetera.core.notifications.INotification.Severity inSeverity); + void setSeverity(INotification.Severity inSeverity); /** * Get the message value. * diff --git a/strategy/strategy-api/src/main/java/org/marketcetera/strategy/StrategyPermissions.java b/strategy/strategy-api/src/main/java/org/marketcetera/strategy/StrategyPermissions.java index 0fb3411ba6..a57398da65 100644 --- a/strategy/strategy-api/src/main/java/org/marketcetera/strategy/StrategyPermissions.java +++ b/strategy/strategy-api/src/main/java/org/marketcetera/strategy/StrategyPermissions.java @@ -22,6 +22,7 @@ public enum StrategyPermissions CancelStrategyUploadAction, ClearStrategyEventsAction, CreateStrategyMessagesAction, + DeleteStrategyMessagesAction, LoadStrategyAction, ReadStrategyAction, ReadStrategyMessagesAction, diff --git a/strategy/strategy-api/src/main/java/org/marketcetera/strategy/StrategyService.java b/strategy/strategy-api/src/main/java/org/marketcetera/strategy/StrategyService.java index 372fa43e74..ea605ef600 100644 --- a/strategy/strategy-api/src/main/java/org/marketcetera/strategy/StrategyService.java +++ b/strategy/strategy-api/src/main/java/org/marketcetera/strategy/StrategyService.java @@ -28,7 +28,7 @@ public interface StrategyService * Requests loaded strategy instances. * * @param inCurrentUserName a String value - * @returns a Collection<StrategyInstance> value + * @return a Collection<StrategyInstance> value */ Collection getStrategyInstances(String inCurrentUserName); /** @@ -37,7 +37,7 @@ public interface StrategyService * @param inStrategyName a String value * @param inSeverity a Severity value * @param inPageRequest an PageRequest value - * @returns a CollectionPageResponse value + * @return a CollectionPageResponse<? extends StrategyMessage> value */ CollectionPageResponse getStrategyMessages(String inStrategyName, Severity inSeverity, @@ -49,18 +49,30 @@ CollectionPageResponse getStrategyMessages(String inS * @return a StrategyMessage value */ StrategyMessage createStrategyMessage(StrategyMessage inStrategyMessage); + /** + * Delete the strategy message with the given unique identifier. + * + * @param inStrategyMessageId a long value + */ + void deleteStrategyMessage(long inStrategyMessageId); + /** + * Delete all strategy messages for the given strategy instance. + * + * @param inStrategyInstanceName a String value + */ + void deleteAllStrategyMessages(String inStrategyInstanceName); /** * Finds the strategy instance with the given name. * * @param inName a String value - * @returns an Optional value + * @return an Optional<? extends StrategyInstance> value */ Optional findByName(String inName); /** * Load a new strategy instances. * * @param inStrategyInstance an StrategyInstance value - * @returns an StrategyStatus value + * @return a StrategyStatus value */ StrategyStatus loadStrategyInstance(StrategyInstance inStrategyInstance); /** diff --git a/strategy/strategy-core/.gitignore b/strategy/strategy-core/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/strategy/strategy-core/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/strategy/strategy-core/src/main/java/org/marketcetera/strategy/SimpleStrategyInstanceFactory.java b/strategy/strategy-core/src/main/java/org/marketcetera/strategy/SimpleStrategyInstanceFactory.java index 3686ec646a..5b2fc3bf57 100644 --- a/strategy/strategy-core/src/main/java/org/marketcetera/strategy/SimpleStrategyInstanceFactory.java +++ b/strategy/strategy-core/src/main/java/org/marketcetera/strategy/SimpleStrategyInstanceFactory.java @@ -3,6 +3,8 @@ // package org.marketcetera.strategy; +import org.marketcetera.core.Preserve; + /* $License$ */ /** @@ -12,6 +14,7 @@ * @version $Id$ * @since $Release$ */ +@Preserve public class SimpleStrategyInstanceFactory implements org.marketcetera.strategy.StrategyInstanceFactory { @@ -28,7 +31,7 @@ public org.marketcetera.strategy.SimpleStrategyInstance create() /** * Create a new org.marketcetera.strategy.SimpleStrategyInstance instance from the given object. * - * @param inStrategyInstance an org.marketcetera.strategy.SimpleStrategyInstance value + * @param inSimpleStrategyInstance an org.marketcetera.strategy.SimpleStrategyInstance value * @return an org.marketcetera.strategy.SimpleStrategyInstance value */ @Override diff --git a/strategy/strategy-core/src/main/java/org/marketcetera/strategy/SimpleStrategyMessage.java b/strategy/strategy-core/src/main/java/org/marketcetera/strategy/SimpleStrategyMessage.java index 4fb02412ac..014e7f66ae 100644 --- a/strategy/strategy-core/src/main/java/org/marketcetera/strategy/SimpleStrategyMessage.java +++ b/strategy/strategy-core/src/main/java/org/marketcetera/strategy/SimpleStrategyMessage.java @@ -3,6 +3,12 @@ // package org.marketcetera.strategy; +import java.util.Date; + +import org.apache.commons.lang3.StringUtils; +import org.marketcetera.core.Preserve; +import org.marketcetera.core.notifications.INotification; + /* $License$ */ /** @@ -12,6 +18,7 @@ * @version $Id$ * @since $Release$ */ +@Preserve public class SimpleStrategyMessage implements StrategyMessage { @@ -27,6 +34,7 @@ public SimpleStrategyMessage() {} public SimpleStrategyMessage(StrategyMessage inStrategyMessage) { setStrategyInstance(inStrategyMessage.getStrategyInstance()); + setStrategyMessageId(inStrategyMessage.getStrategyMessageId()); setMessageTimestamp(inStrategyMessage.getMessageTimestamp()); setSeverity(inStrategyMessage.getSeverity()); setMessage(inStrategyMessage.getMessage()); @@ -34,63 +42,71 @@ public SimpleStrategyMessage(StrategyMessage inStrategyMessage) /** * Get the strategyInstance value. * - * @return an org.marketcetera.strategy.StrategyInstance value + * @return a StrategyInstance value */ @Override - public org.marketcetera.strategy.StrategyInstance getStrategyInstance() + public StrategyInstance getStrategyInstance() { return strategyInstance; } /** * Set the strategyInstance value. * - * @param inStrategyInstance an org.marketcetera.strategy.StrategyInstance value + * @param inStrategyInstance a StrategyInstance value */ @Override - public void setStrategyInstance(org.marketcetera.strategy.StrategyInstance inStrategyInstance) + public void setStrategyInstance(StrategyInstance inStrategyInstance) { strategyInstance = inStrategyInstance; } /** * Get the messageTimestamp value. * - * @return a java.util.Date value + * @return a Date value */ @Override - public java.util.Date getMessageTimestamp() + public Date getMessageTimestamp() { return messageTimestamp; } /** * Set the messageTimestamp value. * - * @param inMessageTimestamp a java.util.Date value + * @param inMessageTimestamp a Date value */ @Override - public void setMessageTimestamp(java.util.Date inMessageTimestamp) + public void setMessageTimestamp(Date inMessageTimestamp) { messageTimestamp = inMessageTimestamp; } /** * Get the severity value. * - * @return an org.marketcetera.core.notifications.INotification.Severity value + * @return an INotification.Severity value */ @Override - public org.marketcetera.core.notifications.INotification.Severity getSeverity() + public INotification.Severity getSeverity() { return severity; } /** * Set the severity value. * - * @param inSeverity an org.marketcetera.core.notifications.INotification.Severity value + * @param inSeverity an INotification.Severity value */ @Override - public void setSeverity(org.marketcetera.core.notifications.INotification.Severity inSeverity) + public void setSeverity(INotification.Severity inSeverity) { severity = inSeverity; } + /* (non-Javadoc) + * @see StrategyMessage#getStrategyMessageId() + */ + @Override + public long getStrategyMessageId() + { + return strategyMessageId; + } /** * Get the message value. * @@ -109,7 +125,7 @@ public String getMessage() @Override public void setMessage(String inMessage) { - message = org.apache.commons.lang.StringUtils.trimToNull(inMessage); + message = StringUtils.trimToNull(inMessage); } /* (non-Javadoc) * @see java.lang.Object#toString() @@ -119,26 +135,40 @@ public String toString() { StringBuilder builder = new StringBuilder(); builder.append("StrategyMessage [") - .append("strategyInstance=").append(strategyInstance) + .append("strategyMessageId=").append(strategyMessageId) + .append(", strategyInstance=").append(strategyInstance) .append(", messageTimestamp=").append(messageTimestamp) .append(", severity=").append(severity) .append(", message=").append(message).append("]"); return builder.toString(); } + /** + * Sets the strategyMessageId value. + * + * @param inStrategyMessageId a long value + */ + public void setStrategyMessageId(long inStrategyMessageId) + { + strategyMessageId = inStrategyMessageId; + } /** * strategy which created this message */ - private org.marketcetera.strategy.StrategyInstance strategyInstance; + private StrategyInstance strategyInstance; /** * date message was created */ - private java.util.Date messageTimestamp; + private Date messageTimestamp; /** * strategy message severity */ - private org.marketcetera.core.notifications.INotification.Severity severity; + private INotification.Severity severity; /** * message from the strategy */ private String message; + /** + * uniquely identifies this message + */ + private long strategyMessageId; } diff --git a/strategy/strategy-core/src/main/java/org/marketcetera/strategy/SimpleStrategyMessageFactory.java b/strategy/strategy-core/src/main/java/org/marketcetera/strategy/SimpleStrategyMessageFactory.java index 7c69d33bce..eee8a1db51 100644 --- a/strategy/strategy-core/src/main/java/org/marketcetera/strategy/SimpleStrategyMessageFactory.java +++ b/strategy/strategy-core/src/main/java/org/marketcetera/strategy/SimpleStrategyMessageFactory.java @@ -3,6 +3,8 @@ // package org.marketcetera.strategy; +import org.marketcetera.core.Preserve; + /* $License$ */ /** @@ -12,6 +14,7 @@ * @version $Id$ * @since $Release$ */ +@Preserve public class SimpleStrategyMessageFactory implements org.marketcetera.strategy.StrategyMessageFactory { @@ -32,8 +35,8 @@ public org.marketcetera.strategy.SimpleStrategyMessage create() * @return an org.marketcetera.strategy.SimpleStrategyMessage value */ @Override - public org.marketcetera.strategy.SimpleStrategyMessage create(org.marketcetera.strategy.StrategyMessage inSimpleStrategyMessage) + public org.marketcetera.strategy.SimpleStrategyMessage create(org.marketcetera.strategy.StrategyMessage inStrategyMessage) { - return new org.marketcetera.strategy.SimpleStrategyMessage(inSimpleStrategyMessage); + return new org.marketcetera.strategy.SimpleStrategyMessage(inStrategyMessage); } } diff --git a/strategy/strategy-rpc-client/.gitignore b/strategy/strategy-rpc-client/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/strategy/strategy-rpc-client/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/strategy/strategy-rpc-client/src/main/java/org/marketcetera/strategy/StrategyRpcClient.java b/strategy/strategy-rpc-client/src/main/java/org/marketcetera/strategy/StrategyRpcClient.java index 575eb9d721..4fbcf34fa6 100644 --- a/strategy/strategy-rpc-client/src/main/java/org/marketcetera/strategy/StrategyRpcClient.java +++ b/strategy/strategy-rpc-client/src/main/java/org/marketcetera/strategy/StrategyRpcClient.java @@ -69,14 +69,14 @@ public class StrategyRpcClient implements StrategyClient { /* (non-Javadoc) - * @see org.marketcetera.strategy.StrategyClient#findByName(String) + * @see StrategyClient#findByName(String) */ @Override - public Optional findByName(String inName) + public Optional findByName(String inName) { - return executeCall(new Callable>() { + return executeCall(new Callable>() { @Override - public Optional call() + public Optional call() throws Exception { StrategyRpc.FindStrategyInstanceByNameRequest.Builder requestBuilder = StrategyRpc.FindStrategyInstanceByNameRequest.newBuilder(); @@ -122,7 +122,7 @@ public Collection call() ); } /* (non-Javadoc) - * @see org.marketcetera.strategy.StrategyClient#getStrategyMessages(String,String,PageRequest) + * @see StrategyClient#getStrategyMessages(String,String,PageRequest) */ @Override public CollectionPageResponse getStrategyMessages(String inStrategyName, @@ -158,7 +158,7 @@ public CollectionPageResponse call() ); } /* (non-Javadoc) - * @see org.marketcetera.strategy.StrategyClient#unloadStrategyInstance(String) + * @see StrategyClient#unloadStrategyInstance(String) */ @Override public void unloadStrategyInstance(String inStrategyInstanceName) @@ -202,7 +202,7 @@ public StrategyStatus call() ); } /* (non-Javadoc) - * @see org.marketcetera.strategy.StrategyClient#startStrategyInstance(String) + * @see StrategyClient#startStrategyInstance(String) */ @Override public void startStrategyInstance(String inStrategyInstanceName) @@ -224,7 +224,7 @@ public Void call() ); } /* (non-Javadoc) - * @see org.marketcetera.strategy.StrategyClient#stopStrategyInstance(String) + * @see StrategyClient#stopStrategyInstance(String) */ @Override public void stopStrategyInstance(String inStrategyInstanceName) @@ -246,10 +246,10 @@ public Void call() ); } /* (non-Javadoc) - * @see org.marketcetera.strategy.StrategyClient#uploadFile(org.marketcetera.strategy.FileUploadRequest) + * @see StrategyClient#uploadFile(FileUploadRequest) */ @Override - public void uploadFile(org.marketcetera.strategy.FileUploadRequest inRequest) + public void uploadFile(FileUploadRequest inRequest) throws IOException, NoSuchAlgorithmException { SLF4JLoggerProxy.trace(this, @@ -307,7 +307,7 @@ public void uploadFile(org.marketcetera.strategy.FileUploadRequest inRequest) fileUploadObserver.currentStatus); } /* (non-Javadoc) - * @see org.marketcetera.strategy.StrategyClient#addStrategyEventListener(org.marketcetera.strategy.StrategyEventListener) + * @see StrategyClient#addStrategyEventListener(StrategyEventListener) */ @Override public void addStrategyEventListener(StrategyEventListener inListener) @@ -344,7 +344,7 @@ public Void call() }); } /* (non-Javadoc) - * @see org.marketcetera.strategy.StrategyClient#removeStrategyEventListener(org.marketcetera.strategy.StrategyEventListener) + * @see StrategyClient#removeStrategyEventListener(StrategyEventListener) */ @Override public void removeStrategyEventListener(StrategyEventListener inListener) @@ -381,7 +381,7 @@ public Void call() }); } /* (non-Javadoc) - * @see org.marketcetera.strategy.StrategyClient#emitMessage(org.marketcetera.core.notifications.INotification.Severity, java.lang.String) + * @see StrategyClient#emitMessage(org.marketcetera.core.notifications.INotification.Severity, java.lang.String) */ @Override public void emitMessage(Severity inSeverity, @@ -413,6 +413,50 @@ public Void call() }} ); } + /* (non-Javadoc) + * @see StrategyClient#deleteStrategyMessage(long) + */ + @Override + public void deleteStrategyMessage(long inStrategyMessageId) + { + executeCall(new Callable() { + @Override + public Void call() + throws Exception + { + StrategyRpc.DeleteStrategyMessageRequest.Builder requestBuilder = StrategyRpc.DeleteStrategyMessageRequest.newBuilder(); + requestBuilder.setSessionId(getSessionId().getValue()); + requestBuilder.setStrategyMessageId(inStrategyMessageId); + StrategyRpc.DeleteStrategyMessageRequest request = requestBuilder.build(); + SLF4JLoggerProxy.trace(StrategyRpcClient.this,"{} sending {}",getSessionId(),request); + StrategyRpc.DeleteStrategyMessageResponse response = getBlockingStub().deleteStrategyMessage(request); + SLF4JLoggerProxy.trace(StrategyRpcClient.this,"{} received {}",getSessionId(),response); + return null; + }} + ); + } + /* (non-Javadoc) + * @see StrategyClient#deleteAllStrategyMessages(java.lang.String) + */ + @Override + public void deleteAllStrategyMessages(String inStrategyInstanceName) + { + executeCall(new Callable() { + @Override + public Void call() + throws Exception + { + StrategyRpc.DeleteAllStrategyMessagesRequest.Builder requestBuilder = StrategyRpc.DeleteAllStrategyMessagesRequest.newBuilder(); + requestBuilder.setSessionId(getSessionId().getValue()); + requestBuilder.setStrategyInstanceName(inStrategyInstanceName); + StrategyRpc.DeleteAllStrategyMessagesRequest request = requestBuilder.build(); + SLF4JLoggerProxy.trace(StrategyRpcClient.this,"{} sending {}",getSessionId(),request); + StrategyRpc.DeleteAllStrategyMessagesResponse response = getBlockingStub().deleteAllStrategyMessages(request); + SLF4JLoggerProxy.trace(StrategyRpcClient.this,"{} received {}",getSessionId(),response); + return null; + }} + ); + } /** * Provides an interface between trade message stream listeners and their handlers. * @@ -453,7 +497,7 @@ protected StrategyEventListenerProxy(StrategyEventListener inStrategyEventListen } } /** - * + * Observes the file upload process. * * @author Colin DuPlantis * @version $Id$ @@ -465,16 +509,16 @@ private static class FileUploadObserver /** * Create a new FileUploadObserver instance. * - * @param inRequest + * @param inRequest a FileUploadRequest value */ - public FileUploadObserver(org.marketcetera.strategy.FileUploadRequest inRequest) + public FileUploadObserver(FileUploadRequest inRequest) { request = inRequest; } /** + * Increment the bytes uploaded value. * - * - * @param inSize + * @param inSize an int value */ public void incrementBytesUploaded(int inSize) { @@ -482,16 +526,18 @@ public void incrementBytesUploaded(int inSize) double percentComplete = bytesUploaded / fileSize; request.onProgress(percentComplete); } - private double bytesUploaded = 0; /** + * Sets the size of the file to be uploaded. * - * - * @param inFileSize + * @param inFileSize a long value */ private void setFileSize(long inFileSize) { fileSize = inFileSize; } + /* (non-Javadoc) + * @see io.grpc.stub.StreamObserver#onNext(java.lang.Object) + */ @Override public void onNext(StrategyRpc.FileUploadResponse inFileUploadResponse) { @@ -500,12 +546,18 @@ public void onNext(StrategyRpc.FileUploadResponse inFileUploadResponse) "File upload status: {}", currentStatus); } + /* (non-Javadoc) + * @see io.grpc.stub.StreamObserver#onError(java.lang.Throwable) + */ @Override public void onError(Throwable inError) { request.onError(inError); request.onStatus(FileUploadStatus.FAILED); } + /* (non-Javadoc) + * @see io.grpc.stub.StreamObserver#onCompleted() + */ @Override public void onCompleted() { @@ -516,10 +568,30 @@ public void onCompleted() uploadError); request.onStatus(uploadError == null ? FileUploadStatus.SUCCESS : FileUploadStatus.FAILED); } + /** + * indicates the total number of bytes uploaded so far + */ + private double bytesUploaded = 0; + /** + * indicates the total size of the file to be uploaded + */ private double fileSize; - private final org.marketcetera.strategy.FileUploadRequest request; + /** + * holds the file upload request + */ + private final FileUploadRequest request; + /** + * indicates if the file upload has completed or not + */ + @SuppressWarnings("unused") private boolean completed = false; + /** + * holds the error that occurred during upload, if any + */ private Throwable uploadError; + /** + * holds the current status of the upload + */ private StrategyTypesRpc.FileUploadStatus currentStatus = StrategyTypesRpc.FileUploadStatus.UNRECOGNIZED; } /* (non-Javadoc) diff --git a/strategy/strategy-rpc-core/.gitignore b/strategy/strategy-rpc-core/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/strategy/strategy-rpc-core/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/strategy/strategy-rpc-core/src/main/java/org/marketcetera/strategy/StrategyRpcUtil.java b/strategy/strategy-rpc-core/src/main/java/org/marketcetera/strategy/StrategyRpcUtil.java index b56efc685a..61614ed2c8 100644 --- a/strategy/strategy-rpc-core/src/main/java/org/marketcetera/strategy/StrategyRpcUtil.java +++ b/strategy/strategy-rpc-core/src/main/java/org/marketcetera/strategy/StrategyRpcUtil.java @@ -6,7 +6,9 @@ import java.util.Optional; import org.marketcetera.admin.UserFactory; +import org.marketcetera.admin.rpc.AdminRpcUtil; import org.marketcetera.core.Preserve; +import org.marketcetera.core.notifications.INotification; import org.marketcetera.rpc.base.BaseRpcUtil; import org.marketcetera.strategy.events.SimpleStrategyMessageEvent; import org.marketcetera.strategy.events.SimpleStrategyStartFailedEvent; @@ -41,16 +43,16 @@ public abstract class StrategyRpcUtil /** * Get the RPC object from the given value. * - * @param inStrategyInstance a org.marketcetera.strategy.StrategyInstance value - * @return a java.util.Optional value + * @param inStrategyInstance a StrategyInstance value + * @return an Optional<StrategyTypesRpc.StrategyInstance> value */ - public static java.util.Optional getRpcStrategyInstance(org.marketcetera.strategy.StrategyInstance inStrategyInstance) + public static Optional getRpcStrategyInstance(StrategyInstance inStrategyInstance) { if(inStrategyInstance == null) { - return java.util.Optional.empty(); + return Optional.empty(); } StrategyTypesRpc.StrategyInstance.Builder builder = StrategyTypesRpc.StrategyInstance.newBuilder(); - org.marketcetera.admin.rpc.AdminRpcUtil.getRpcUser(inStrategyInstance.getUser()).ifPresent(value->builder.setUser(value)); + AdminRpcUtil.getRpcUser(inStrategyInstance.getUser()).ifPresent(value->builder.setUser(value)); if(inStrategyInstance.getName() != null) { builder.setName(inStrategyInstance.getName()); } @@ -65,129 +67,136 @@ public static java.util.Optional getRpcStrate } org.marketcetera.rpc.base.BaseRpcUtil.getTimestampValue(inStrategyInstance.getStarted()).ifPresent(value->builder.setStarted(value)); getRpcStrategyStatus(inStrategyInstance.getStatus()).ifPresent(value->builder.setStatus(value)); - return java.util.Optional.of(builder.build()); + return Optional.of(builder.build()); } /** * Get the object from the given RPC value. * - * @param inStrategyStatusan org.marketcetera.strategy.StrategyTypesRpc.StrategyStatus value - * @return an org.marketcetera.strategy.StrategyStatus value + * @param inStrategyStatus an StrategyTypesRpc.StrategyStatus value + * @return an Optional<StrategyStatus> value */ - public static java.util.Optional getStrategyStatus(org.marketcetera.strategy.StrategyTypesRpc.StrategyStatus inStrategyStatus) + public static Optional getStrategyStatus(StrategyTypesRpc.StrategyStatus inStrategyStatus) { if(inStrategyStatus == null) { - return java.util.Optional.empty(); + return Optional.empty(); } - return java.util.Optional.of(org.marketcetera.strategy.StrategyStatus.values()[inStrategyStatus.getNumber()]); + return Optional.of(StrategyStatus.values()[inStrategyStatus.getNumber()]); } /** * Get the RPC value from the given object. * - * @param inRpcStrategyStatus a org.marketcetera.strategy.StrategyStatus value - * @return an org.marketcetera.strategy.StrategyTypesRpc.StrategyStatus value + * @param inRpcStrategyStatus a StrategyStatus value + * @return an Optional<StrategyTypesRpc.StrategyStatus> value */ - public static java.util.Optional getRpcStrategyStatus(org.marketcetera.strategy.StrategyStatus inRpcStrategyStatus) + public static Optional getRpcStrategyStatus(StrategyStatus inRpcStrategyStatus) { if(inRpcStrategyStatus == null) { - return java.util.Optional.empty(); + return Optional.empty(); } - return java.util.Optional.of(org.marketcetera.strategy.StrategyTypesRpc.StrategyStatus.forNumber(inRpcStrategyStatus.ordinal())); + return Optional.of(StrategyTypesRpc.StrategyStatus.forNumber(inRpcStrategyStatus.ordinal())); } /** * Get the RPC object from the given value. * - * @param inStrategyMessage a org.marketcetera.strategy.StrategyMessage value - * @return a java.util.Optional value + * @param inStrategyMessage a StrategyMessage value + * @return an Optional<StrategyTypesRpc.StrategyMessage> value */ - public static java.util.Optional getRpcStrategyMessage(org.marketcetera.strategy.StrategyMessage inStrategyMessage) + public static Optional getRpcStrategyMessage(StrategyMessage inStrategyMessage) { if(inStrategyMessage == null) { - return java.util.Optional.empty(); + return Optional.empty(); } StrategyTypesRpc.StrategyMessage.Builder builder = StrategyTypesRpc.StrategyMessage.newBuilder(); - org.marketcetera.strategy.StrategyRpcUtil.getRpcStrategyInstance(inStrategyMessage.getStrategyInstance()).ifPresent(value->builder.setStrategyInstance(value)); + StrategyRpcUtil.getRpcStrategyInstance(inStrategyMessage.getStrategyInstance()).ifPresent(value->builder.setStrategyInstance(value)); getRpcStrategyMessageSeverity(inStrategyMessage.getSeverity()).ifPresent(value->builder.setSeverity(value)); BaseRpcUtil.getTimestampValue(inStrategyMessage.getMessageTimestamp()).ifPresent(rpcTimestamp -> builder.setMessageTimestamp(rpcTimestamp)); if(inStrategyMessage.getMessage() != null) { builder.setMessage(inStrategyMessage.getMessage()); } - return java.util.Optional.of(builder.build()); + builder.setStrategyMessageId(inStrategyMessage.getStrategyMessageId()); + return Optional.of(builder.build()); } /** * Get the object from the given RPC value. * - * @param inStrategyMessage an org.marketcetera.strategy.StrategyTypesRpc.StrategyMessage value - * @param inStrategyMessageFactory an org.marketcetera.strategy.StrategyMessageFactory value - * @param inStrategyInstanceFactory an org.marketcetera.strategy.StrategyInstanceFactory value - * @param inUserFactory an org.marketcetera.admin.UserFactory value - * @return an org.marketcetera.strategy.StrategyMessage value + * @param inStrategyMessage an StrategyTypesRpc.StrategyMessage value + * @param inStrategyMessageFactory an StrategyMessageFactory value + * @param inStrategyInstanceFactory an StrategyInstanceFactory value + * @param inUserFactory an UserFactory value + * @return an Optional<StrategyMessage> value */ - public static java.util.Optional getStrategyMessage(org.marketcetera.strategy.StrategyTypesRpc.StrategyMessage inStrategyMessage,org.marketcetera.strategy.StrategyMessageFactory inStrategyMessageFactory,org.marketcetera.strategy.StrategyInstanceFactory inStrategyInstanceFactory,org.marketcetera.admin.UserFactory inUserFactory) + public static Optional getStrategyMessage(StrategyTypesRpc.StrategyMessage inStrategyMessage, + StrategyMessageFactory inStrategyMessageFactory, + StrategyInstanceFactory inStrategyInstanceFactory, + UserFactory inUserFactory) { if(inStrategyMessage == null) { - return java.util.Optional.empty(); + return Optional.empty(); } - org.marketcetera.strategy.StrategyMessage strategyMessage = inStrategyMessageFactory.create(); - org.marketcetera.strategy.StrategyRpcUtil.getStrategyInstance(inStrategyMessage.getStrategyInstance(),inStrategyInstanceFactory,inUserFactory).ifPresent(value->strategyMessage.setStrategyInstance(value)); + StrategyMessage strategyMessage = inStrategyMessageFactory.create(); + StrategyRpcUtil.getStrategyInstance(inStrategyMessage.getStrategyInstance(),inStrategyInstanceFactory,inUserFactory).ifPresent(value->strategyMessage.setStrategyInstance(value)); getStrategyMessageSeverity(inStrategyMessage.getSeverity()).ifPresent(value->strategyMessage.setSeverity(value)); BaseRpcUtil.getDateValue(inStrategyMessage.getMessageTimestamp()).ifPresent(messageTimestamp -> strategyMessage.setMessageTimestamp(messageTimestamp)); strategyMessage.setMessage(inStrategyMessage.getMessage()); - return java.util.Optional.of(strategyMessage); + ((SimpleStrategyMessage)strategyMessage).setStrategyMessageId(inStrategyMessage.getStrategyMessageId()); + return Optional.of(strategyMessage); } /** * Get the object from the given RPC value. * - * @param inStrategyInstance an org.marketcetera.strategy.StrategyTypesRpc.StrategyInstance value - * @param inStrategyInstanceFactory an org.marketcetera.strategy.StrategyInstanceFactory value - * @param inUserFactory an org.marketcetera.admin.UserFactory value - * @return an org.marketcetera.strategy.StrategyInstance value + * @param inStrategyInstance an StrategyTypesRpc.StrategyInstance value + * @param inStrategyInstanceFactory an StrategyInstanceFactory value + * @param inUserFactory an UserFactory value + * @return an Optional<StrategyInstance> value */ - public static java.util.Optional getStrategyInstance(org.marketcetera.strategy.StrategyTypesRpc.StrategyInstance inStrategyInstance,org.marketcetera.strategy.StrategyInstanceFactory inStrategyInstanceFactory,org.marketcetera.admin.UserFactory inUserFactory) + public static Optional getStrategyInstance(StrategyTypesRpc.StrategyInstance inStrategyInstance, + StrategyInstanceFactory inStrategyInstanceFactory, + UserFactory inUserFactory) { if(inStrategyInstance == null) { - return java.util.Optional.empty(); + return Optional.empty(); } - org.marketcetera.strategy.StrategyInstance strategyInstance = inStrategyInstanceFactory.create(); - org.marketcetera.admin.rpc.AdminRpcUtil.getUser(inStrategyInstance.getUser(),inUserFactory).ifPresent(value->strategyInstance.setUser(value)); + StrategyInstance strategyInstance = inStrategyInstanceFactory.create(); + AdminRpcUtil.getUser(inStrategyInstance.getUser(),inUserFactory).ifPresent(value->strategyInstance.setUser(value)); strategyInstance.setName(inStrategyInstance.getName()); strategyInstance.setFilename(inStrategyInstance.getFilename()); strategyInstance.setHash(inStrategyInstance.getHash()); strategyInstance.setNonce(inStrategyInstance.getNonce()); org.marketcetera.rpc.base.BaseRpcUtil.getDateValue(inStrategyInstance.getStarted()).ifPresent(value->strategyInstance.setStarted(value)); getStrategyStatus(inStrategyInstance.getStatus()).ifPresent(value->strategyInstance.setStatus(value)); - return java.util.Optional.of(strategyInstance); + return Optional.of(strategyInstance); } /** * Get the object from the given RPC value. * - * @param inSeverityan org.marketcetera.strategy.StrategyTypesRpc.StrategyMessageSeverity value - * @return an org.marketcetera.core.notifications.INotification.Severity value + * @param inSeverity an StrategyTypesRpc.StrategyMessageSeverity value + * @return an Optional<INotification.Severity> value */ - public static java.util.Optional getStrategyMessageSeverity(org.marketcetera.strategy.StrategyTypesRpc.StrategyMessageSeverity inSeverity) + public static Optional getStrategyMessageSeverity(StrategyTypesRpc.StrategyMessageSeverity inSeverity) { if(inSeverity == null) { - return java.util.Optional.empty(); + return Optional.empty(); } - return java.util.Optional.of(org.marketcetera.core.notifications.INotification.Severity.values()[inSeverity.getNumber()]); + return Optional.of(INotification.Severity.values()[inSeverity.getNumber()]); } /** * Get the RPC value from the given object. * - * @param inRpcSeverity a org.marketcetera.core.notifications.INotification.Severity value - * @return an org.marketcetera.strategy.StrategyTypesRpc.StrategyMessageSeverity value + * @param inRpcSeverity a INotification.Severity value + * @return an Optional<StrategyTypesRpc.StrategyMessageSeverity> value */ - public static java.util.Optional getRpcStrategyMessageSeverity(org.marketcetera.core.notifications.INotification.Severity inRpcSeverity) + public static Optional getRpcStrategyMessageSeverity(INotification.Severity inRpcSeverity) { if(inRpcSeverity == null) { - return java.util.Optional.empty(); + return Optional.empty(); } - return java.util.Optional.of(org.marketcetera.strategy.StrategyTypesRpc.StrategyMessageSeverity.forNumber(inRpcSeverity.ordinal())); + return Optional.of(StrategyTypesRpc.StrategyMessageSeverity.forNumber(inRpcSeverity.ordinal())); } /** + * Write the given strategy event to the given response builder. * - * - * @param inStrategyEvent - * @param inResponseBuilder + * @param inStrategyEvent a StrategyEvent value + * @param inResponseBuilder a StrategyRpc.StrategyEventListenerResponse.Builder value */ public static void setStrategyEvent(StrategyEvent inStrategyEvent, StrategyRpc.StrategyEventListenerResponse.Builder inResponseBuilder) @@ -219,6 +228,7 @@ public static void setStrategyEvent(StrategyEvent inStrategyEvent, rpcEventBuilder.setMessage(messageEvent.getStrategyMessage().getMessage()); getRpcStrategyMessageSeverity(messageEvent.getStrategyMessage().getSeverity()).ifPresent(rpcSeverity -> rpcEventBuilder.setSeverity(rpcSeverity)); BaseRpcUtil.getTimestampValue(messageEvent.getStrategyMessage().getMessageTimestamp()).ifPresent(rpcTimestamp -> rpcEventBuilder.setMessageTimestamp(rpcTimestamp)); + rpcEventBuilder.setId(messageEvent.getStrategyMessage().getStrategyMessageId()); } else { throw new UnsupportedOperationException("Unexpected strategy event type: " + inStrategyEvent.getClass().getSimpleName()); } @@ -249,6 +259,7 @@ public static StrategyEvent getStrategyEvent(StrategyRpc.StrategyEventListenerRe SimpleStrategyMessageEvent messageEvent = new SimpleStrategyMessageEvent(); SimpleStrategyMessage message = new SimpleStrategyMessage(); message.setMessage(rpcEvent.getMessage()); + message.setStrategyMessageId(rpcEvent.getId()); getStrategyMessageSeverity(rpcEvent.getSeverity()).ifPresent(severity -> message.setSeverity(severity)); BaseRpcUtil.getDateValue(rpcEvent.getMessageTimestamp()).ifPresent(timestamp -> message.setMessageTimestamp(timestamp)); message.setStrategyInstance(strategyInstance); diff --git a/strategy/strategy-rpc-core/src/main/proto/rpc_strategy.proto b/strategy/strategy-rpc-core/src/main/proto/rpc_strategy.proto index 4b2988176a..de6f3cd872 100644 --- a/strategy/strategy-rpc-core/src/main/proto/rpc_strategy.proto +++ b/strategy/strategy-rpc-core/src/main/proto/rpc_strategy.proto @@ -125,6 +125,23 @@ message CreateStrategyMessageRequest { message CreateStrategyMessageResponse { } +// delete a single strategy message +message DeleteStrategyMessageRequest { + string sessionId = 1; // session id of the authenticated session + int64 strategyMessageId = 2; // uniquely identifies the strategy message +} + +message DeleteStrategyMessageResponse { +} + +message DeleteAllStrategyMessagesRequest { + string sessionId = 1; // session id of the authenticated session + string strategyInstanceName = 2; // name of the strategy instance for which to delete strategy messages +} + +message DeleteAllStrategyMessagesResponse { +} + // services for Strategy service StrategyRpcService { rpc login(LoginRequest) returns (LoginResponse); // starts the session @@ -141,4 +158,6 @@ service StrategyRpcService { rpc removeStrategyEventListener(RemoveStrategyEventListenerRequest) returns (RemoveStrategyEventListenerResponse); rpc startStrategyInstance(StartStrategyInstanceRequest) returns (StartStrategyInstanceResponse); // start a strategy instance rpc stopStrategyInstance(StopStrategyInstanceRequest) returns (StopStrategyInstanceResponse); // stop a strategy instance + rpc deleteStrategyMessage(DeleteStrategyMessageRequest) returns (DeleteStrategyMessageResponse); // delete a strategy message + rpc deleteAllStrategyMessages(DeleteAllStrategyMessagesRequest) returns (DeleteAllStrategyMessagesResponse); // delete all strategy messages for a strategy instance } diff --git a/strategy/strategy-rpc-core/src/main/proto/rpc_strategy_types.proto b/strategy/strategy-rpc-core/src/main/proto/rpc_strategy_types.proto index cc215c9626..4d0864daae 100644 --- a/strategy/strategy-rpc-core/src/main/proto/rpc_strategy_types.proto +++ b/strategy/strategy-rpc-core/src/main/proto/rpc_strategy_types.proto @@ -26,10 +26,11 @@ enum StrategyMessageSeverity { // contains a message from the strategy message StrategyMessage { - StrategyInstance strategyInstance = 1; // strategy that produced the message - StrategyMessageSeverity severity = 2; // describes the severity of the message - string message = 3; // strategy message - google.protobuf.Timestamp messageTimestamp = 4; // date strategy was started + int64 strategyMessageId = 1; // uniquely identifies this strategy + StrategyInstance strategyInstance = 2; // strategy that produced the message + StrategyMessageSeverity severity = 3; // describes the severity of the message + string message = 4; // strategy message + google.protobuf.Timestamp messageTimestamp = 5; // date strategy was started } // describes a loaded strategy @@ -70,4 +71,5 @@ message StrategyEvent { StrategyStatus newStatusValue = 5; StrategyMessageSeverity severity = 6; google.protobuf.Timestamp messageTimestamp = 7; + int64 id = 8; } diff --git a/strategy/strategy-rpc-server/.gitignore b/strategy/strategy-rpc-server/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/strategy/strategy-rpc-server/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/strategy/strategy-rpc-server/src/main/java/org/marketcetera/strategy/StrategyRpcServer.java b/strategy/strategy-rpc-server/src/main/java/org/marketcetera/strategy/StrategyRpcServer.java index 770a102f5b..08b7e4c8e0 100644 --- a/strategy/strategy-rpc-server/src/main/java/org/marketcetera/strategy/StrategyRpcServer.java +++ b/strategy/strategy-rpc-server/src/main/java/org/marketcetera/strategy/StrategyRpcServer.java @@ -27,6 +27,10 @@ import org.marketcetera.rpc.base.BaseRpcUtil; import org.marketcetera.rpc.paging.PagingRpcUtil; import org.marketcetera.rpc.server.AbstractRpcService; +import org.marketcetera.strategy.StrategyRpc.DeleteAllStrategyMessagesRequest; +import org.marketcetera.strategy.StrategyRpc.DeleteAllStrategyMessagesResponse; +import org.marketcetera.strategy.StrategyRpc.DeleteStrategyMessageRequest; +import org.marketcetera.strategy.StrategyRpc.DeleteStrategyMessageResponse; import org.marketcetera.strategy.StrategyRpc.FileUploadResponse; import org.marketcetera.strategy.events.StrategyEvent; import org.marketcetera.util.log.SLF4JLoggerProxy; @@ -54,32 +58,32 @@ public class StrategyRpcServer extends AbstractRpcService { + /** + * Validate and start the object. + */ + @PostConstruct + public void start() + throws Exception + { + service = new Service(); + super.start(); + } /* (non-Javadoc) - * @see AbstractRpcService#getServiceDescription() - */ + * @see AbstractRpcService#getServiceDescription() + */ @Override protected String getServiceDescription() { return description; } /* (non-Javadoc) - * @see AbstractRpcService#getService() - */ + * @see AbstractRpcService#getService() + */ @Override protected StrategyRpcServiceGrpc.StrategyRpcServiceImplBase getService() { return service; } - /** - * Validate and start the object. - */ - @PostConstruct - public void start() - throws Exception - { - service = new Service(); - super.start(); - } /** * Write to the appropriate output file with the given upload metadata or file chunk. * @@ -119,6 +123,15 @@ private void closeFile(OutputStream inWriter) { inWriter.close(); } + /** + * Verify an uploaded strategy file matches the given expected attributes. + * + * @param inStrategyFile a Path vlaue + * @param inNonce a String value + * @param inName a String value + * @throws NoSuchAlgorithmException if the file cannot be hashed + * @throws IOException if the file cannot be read + */ private void verifyAndMoveFile(Path inStrategyFile, String inNonce, String inName) @@ -294,6 +307,58 @@ public void findByName(StrategyRpc.FindStrategyInstanceByNameRequest inFindStrat handleError(e,inResponseObserver); } } + /* (non-Javadoc) + * @see org.marketcetera.strategy.StrategyRpcServiceGrpc.StrategyRpcServiceImplBase#deleteStrategyMessage(org.marketcetera.strategy.StrategyRpc.DeleteStrategyMessageRequest, io.grpc.stub.StreamObserver) + */ + @Override + public void deleteStrategyMessage(DeleteStrategyMessageRequest inRequest, + StreamObserver inResponseObserver) + { + try { + SLF4JLoggerProxy.trace(StrategyRpcServer.this, + "Received {}", + inRequest); + SessionHolder sessionHolder = validateAndReturnSession(inRequest.getSessionId()); + authzService.authorize(sessionHolder.getUser(),StrategyPermissions.DeleteStrategyMessagesAction.name()); + StrategyRpc.DeleteStrategyMessageResponse.Builder responseBuilder = StrategyRpc.DeleteStrategyMessageResponse.newBuilder(); + long strategyMessageId = inRequest.getStrategyMessageId(); + strategyService.deleteStrategyMessage(strategyMessageId); + StrategyRpc.DeleteStrategyMessageResponse response = responseBuilder.build(); + SLF4JLoggerProxy.trace(StrategyRpcServer.this, + "Responding {}", + response); + inResponseObserver.onNext(response); + inResponseObserver.onCompleted(); + } catch (Exception e) { + handleError(e,inResponseObserver); + } + } + /* (non-Javadoc) + * @see org.marketcetera.strategy.StrategyRpcServiceGrpc.StrategyRpcServiceImplBase#deleteAllStrategyMessages(org.marketcetera.strategy.StrategyRpc.DeleteAllStrategyMessagesRequest, io.grpc.stub.StreamObserver) + */ + @Override + public void deleteAllStrategyMessages(DeleteAllStrategyMessagesRequest inRequest, + StreamObserver inResponseObserver) + { + try { + SLF4JLoggerProxy.trace(StrategyRpcServer.this, + "Received {}", + inRequest); + SessionHolder sessionHolder = validateAndReturnSession(inRequest.getSessionId()); + authzService.authorize(sessionHolder.getUser(),StrategyPermissions.DeleteStrategyMessagesAction.name()); + StrategyRpc.DeleteAllStrategyMessagesResponse.Builder responseBuilder = StrategyRpc.DeleteAllStrategyMessagesResponse.newBuilder(); + String strategyInstanceName = inRequest.getStrategyInstanceName(); + strategyService.deleteAllStrategyMessages(strategyInstanceName); + StrategyRpc.DeleteAllStrategyMessagesResponse response = responseBuilder.build(); + SLF4JLoggerProxy.trace(StrategyRpcServer.this, + "Responding {}", + response); + inResponseObserver.onNext(response); + inResponseObserver.onCompleted(); + } catch (Exception e) { + handleError(e,inResponseObserver); + } + } /* (non-Javadoc) * @see StrategyRpcServiceGrpc.StrategyRpcServiceImplBase#loadStrategyInstance(StrategyRpc.LoadStrategyInstanceRequest ,StreamObserver) */ diff --git a/strategy/strategy-sample/.gitignore b/strategy/strategy-sample/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/strategy/strategy-sample/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/strategy/strategy-sample/pom.xml b/strategy/strategy-sample/pom.xml index 242641b0bf..4dd5b82464 100644 --- a/strategy/strategy-sample/pom.xml +++ b/strategy/strategy-sample/pom.xml @@ -29,6 +29,14 @@ ${project.groupId} marketdata-api + + ${project.groupId} + trade-api + + + ${project.groupId} + marketdata-core + diff --git a/strategy/strategy-sample/src/main/java/org/marketcetera/strategy/sample/TestStrategy.java b/strategy/strategy-sample/src/main/java/org/marketcetera/strategy/sample/TestStrategy.java index 879491d966..57209b675d 100644 --- a/strategy/strategy-sample/src/main/java/org/marketcetera/strategy/sample/TestStrategy.java +++ b/strategy/strategy-sample/src/main/java/org/marketcetera/strategy/sample/TestStrategy.java @@ -1,23 +1,43 @@ package org.marketcetera.strategy.sample; +import java.math.BigDecimal; +import java.security.SecureRandom; +import java.util.Random; + import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import org.marketcetera.core.notifications.INotification.Severity; import org.marketcetera.event.Event; +import org.marketcetera.event.QuoteEvent; +import org.marketcetera.event.TopOfBookEvent; +import org.marketcetera.event.TradeEvent; import org.marketcetera.marketdata.Content; +import org.marketcetera.marketdata.MarketDataCacheElement; import org.marketcetera.marketdata.MarketDataClient; import org.marketcetera.marketdata.MarketDataListener; import org.marketcetera.marketdata.MarketDataRequest; import org.marketcetera.marketdata.MarketDataRequestBuilder; import org.marketcetera.strategy.StrategyClient; +import org.marketcetera.trade.Factory; +import org.marketcetera.trade.Instrument; +import org.marketcetera.trade.OrderSingle; +import org.marketcetera.trade.OrderSingleSuggestion; +import org.marketcetera.trade.OrderType; +import org.marketcetera.trade.Side; +import org.marketcetera.trade.client.TradeClient; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.PropertySource; import org.springframework.context.annotation.PropertySources; import org.springframework.stereotype.Component; +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; + /* $License$ */ /** @@ -55,6 +75,21 @@ public void receiveMarketData(Event inEvent) { strategyClient.emitMessage(Severity.INFO, String.valueOf(inEvent)); + if(inEvent instanceof QuoteEvent) { + QuoteEvent quoteEvent = (QuoteEvent)inEvent; + MarketDataCacheElement topOfBookCache = marketDataCache.getUnchecked(quoteEvent.getInstrument()); + topOfBookCache.update(Content.TOP_OF_BOOK, + inEvent); + } else if(inEvent instanceof TradeEvent) { + TradeEvent tradeEvent = (TradeEvent)inEvent; + MarketDataCacheElement topOfBookCache = marketDataCache.getUnchecked(tradeEvent.getInstrument()); + topOfBookCache.update(Content.LATEST_TICK, + inEvent); + issueSuggestion(topOfBookCache); + } else { + strategyClient.emitMessage(Severity.WARN, + "Ignored unexpected event: " + inEvent); + } } }); } @@ -73,10 +108,71 @@ public void stop() } catch (Exception ignored) {} } } + /** + * Create an order suggestion using the cached market data. + * + * @param inCacheElement a MarketDataCacheElement value + */ + private void issueSuggestion(MarketDataCacheElement inCacheElement) + { + if(!createSuggestions) { + return; + } + TopOfBookEvent topOfBook = (TopOfBookEvent)inCacheElement.getSnapshot(Content.TOP_OF_BOOK); + if(topOfBook == null) { + return; + } + QuoteEvent quote; + Side side; + if(random.nextBoolean()) { + // trade on the bid + quote = topOfBook.getBid(); + side = Side.Sell; + } else { + // trade on the ask + quote = topOfBook.getAsk(); + side = Side.Buy; + } + if(quote == null) { + return; + } + OrderSingleSuggestion orderSingleSuggestion = Factory.getInstance().createOrderSingleSuggestion(); + orderSingleSuggestion.setIdentifier("Test Strategy"); + orderSingleSuggestion.setScore(new BigDecimal(random.nextDouble())); + OrderSingle orderSingle = Factory.getInstance().createOrderSingle(); + orderSingle.setInstrument(quote.getInstrument()); + orderSingle.setOrderType(OrderType.Limit); + orderSingle.setPegToMidpoint(true); + orderSingle.setQuantity(new BigDecimal(10*(random.nextInt(10)+1))); + orderSingle.setPrice(quote.getPrice()); + orderSingle.setSide(side); + orderSingleSuggestion.setOrder(orderSingle); + tradeClient.sendOrderSuggestion(orderSingleSuggestion); + } + /** + * caches market data + */ + private final LoadingCache marketDataCache = CacheBuilder.newBuilder().build(new CacheLoader() { + @Override + public MarketDataCacheElement load(Instrument inKey) + throws Exception + { + return new MarketDataCacheElement(inKey); + }} + ); + /** + * generates random numbers + */ + private Random random = new SecureRandom(); /** * holds the market data request id */ private String marketDataRequestId; + /** + * strategy should create suggestions or not + */ + @Value("${metc.strategy.create.suggestions}") + private boolean createSuggestions; /** * provides access to strategy services */ @@ -87,4 +183,9 @@ public void stop() */ @Autowired private MarketDataClient marketDataClient; + /** + * provides access to trade services + */ + @Autowired + private TradeClient tradeClient; } diff --git a/strategy/strategy-sample/src/main/resources/application.properties b/strategy/strategy-sample/src/main/resources/application.properties index e69de29bb2..cd498e097c 100644 --- a/strategy/strategy-sample/src/main/resources/application.properties +++ b/strategy/strategy-sample/src/main/resources/application.properties @@ -0,0 +1,4 @@ +# +# test strategy settings +# +metc.strategy.create.suggestions=true \ No newline at end of file diff --git a/strategy/strategy-server/.gitignore b/strategy/strategy-server/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/strategy/strategy-server/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/strategy/strategy-server/pom.xml b/strategy/strategy-server/pom.xml index 01308f2b80..91aa0a24e1 100644 --- a/strategy/strategy-server/pom.xml +++ b/strategy/strategy-server/pom.xml @@ -38,6 +38,10 @@ ${project.groupId} eventbus-api + + ${project.groupId} + trade-server + com.querydsl diff --git a/strategy/strategy-server/src/main/java/org/marketcetera/strategy/DirectStrategyClient.java b/strategy/strategy-server/src/main/java/org/marketcetera/strategy/DirectStrategyClient.java index f79c25c623..3b1cf376fb 100644 --- a/strategy/strategy-server/src/main/java/org/marketcetera/strategy/DirectStrategyClient.java +++ b/strategy/strategy-server/src/main/java/org/marketcetera/strategy/DirectStrategyClient.java @@ -21,7 +21,7 @@ /* $License$ */ /** - * + * Provides an in-process {@link StrategyClient} implementation. * * @author Colin DuPlantis * @version $Id$ @@ -200,11 +200,26 @@ public DirectStrategyClient(ApplicationContext inApplicationContext, username = StringUtils.trimToNull(inUsername); Validate.notNull(username); } + /* (non-Javadoc) + * @see org.marketcetera.strategy.StrategyClient#deleteStrategyMessage(long) + */ + @Override + public void deleteStrategyMessage(long inStrategyMessageId) + { + strategyService.deleteStrategyMessage(inStrategyMessageId); + } + /* (non-Javadoc) + * @see org.marketcetera.strategy.StrategyClient#deleteAllStrategyMessages(java.lang.String) + */ + @Override + public void deleteAllStrategyMessages(String inStrategyInstanceName) + { + strategyService.deleteAllStrategyMessages(inStrategyInstanceName); + } /** - * + * Get the strategy instance context for this running strategy. * - * - * @return + * @return a StrategyInstanceHolder value */ private StrategyInstanceHolder getStrategyInstanceHolder() { @@ -214,10 +229,9 @@ private StrategyInstanceHolder getStrategyInstanceHolder() return strategyInstanceHolder; } /** - * - * + * Get the strategy message factory for this running strategy. * - * @return + * @return a StrategyMessageFactory value */ private StrategyMessageFactory getStrategyMessageFactory() { @@ -227,10 +241,9 @@ private StrategyMessageFactory getStrategyMessageFactory() return strategyMessageFactory; } /** - * - * + * Get the strategy service value for this running strategy. * - * @return + * @return a StrategyService value */ private StrategyService getStrategyService() { diff --git a/strategy/strategy-server/src/main/java/org/marketcetera/strategy/StrategyServiceImpl.java b/strategy/strategy-server/src/main/java/org/marketcetera/strategy/StrategyServiceImpl.java index 2e711c48e3..e806de29e4 100644 --- a/strategy/strategy-server/src/main/java/org/marketcetera/strategy/StrategyServiceImpl.java +++ b/strategy/strategy-server/src/main/java/org/marketcetera/strategy/StrategyServiceImpl.java @@ -56,6 +56,7 @@ import org.marketcetera.strategy.events.SimpleStrategyUploadFailedEvent; import org.marketcetera.strategy.events.SimpleStrategyUploadSucceededEvent; import org.marketcetera.strategy.events.StrategyEvent; +import org.marketcetera.trade.client.DirectTradeClient; import org.marketcetera.util.log.SLF4JLoggerProxy; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -172,7 +173,7 @@ public void stop() /** * Requests loaded strategy instances. * - * @returns a Collection value + * @return a Collection<StrategyInstance> value */ @Override @Transactional(readOnly=true,propagation=Propagation.REQUIRED) @@ -187,8 +188,8 @@ public Collection getStrategyInstances(String inCurr * * @param inStrategyName a String value * @param inSeverity a Severity value - * @param inPageRequest an PageRequest value - * @returns a CollectionPageResut value + * @param inPageRequest a PageRequest value + * @return a CollectionPageResponse<? extends StrategyMessage> value */ @Override @Transactional(readOnly=true,propagation=Propagation.REQUIRED) @@ -397,12 +398,40 @@ public void unloadStrategyInstance(String inStrategyInstanceName) Path strategyTarget = Paths.get(strategyStorageDirectoryName, strategyInstance.getFilename()); FileUtils.deleteQuietly(strategyTarget.toFile()); - BooleanBuilder where = new BooleanBuilder(); - where = where.and(QPersistentStrategyMessage.persistentStrategyMessage.strategyInstance.eq(strategyInstance)); - strategyMessageDao.deleteAll(strategyMessageDao.findAll(where)); + deleteAllMessagesFor(strategyInstance); strategyInstanceDao.delete(strategyInstance); eventBusService.post(new SimpleStrategyUnloadedEvent(strategyInstance)); } + /* (non-Javadoc) + * @see org.marketcetera.strategy.StrategyService#deleteStrategyMessage(long) + */ + @Override + @Transactional(readOnly=false,propagation=Propagation.REQUIRED) + public void deleteStrategyMessage(long inStrategyMessageId) + { + SLF4JLoggerProxy.debug(this, + "Deleting strategy message with id {}", + inStrategyMessageId); + Optional strategyMessageOption = strategyMessageDao.findByStrategyMessageId(inStrategyMessageId); + Validate.isTrue(strategyMessageOption.isPresent(), + "No strategy message with id '" + inStrategyMessageId + "'"); + strategyMessageDao.delete(strategyMessageOption.get()); + } + /* (non-Javadoc) + * @see org.marketcetera.strategy.StrategyService#deleteAllStrategyMessages(java.lang.String) + */ + @Override + @Transactional(readOnly=false,propagation=Propagation.REQUIRED) + public void deleteAllStrategyMessages(String inStrategyInstanceName) + { + Validate.notNull(inStrategyInstanceName, + "Strategy instance name required"); + Optional strategyInstanceOption = strategyInstanceDao.findByName(inStrategyInstanceName); + Validate.isTrue(strategyInstanceOption.isPresent(), + "No strategy instance by name '" + inStrategyInstanceName + "'"); + PersistentStrategyInstance strategyInstance = strategyInstanceOption.get(); + deleteAllMessagesFor(strategyInstance); + } /* (non-Javadoc) * @see StrategyService#getIncomingStrategyDirectory() */ @@ -422,8 +451,8 @@ public Path getTemporaryStrategyDirectory() /** * Load a new strategy instances. * - * @param inStrategyInstance an StrategyInstance value - * @returns an StrategyStatus value + * @param inFile a File value + * @param inOriginalFileName a String value */ @Override @Transactional(readOnly=false,propagation=Propagation.REQUIRED) @@ -485,7 +514,7 @@ public void received(File inFile, * Load a new strategy instances. * * @param inStrategyInstance an StrategyInstance value - * @returns an StrategyStatus value + * @return a StrategyStatus value */ @Override @Transactional(readOnly=false,propagation=Propagation.REQUIRED) @@ -559,7 +588,7 @@ public void removeStrategyEventListener(StrategyEventListener inListener) * Finds the strategy instance with the given name. * * @param inName a String value - * @returns a Optional value + * @return a Optional<? extends StrategyInstance> value */ @Override @Transactional(readOnly=true,propagation=Propagation.REQUIRED) @@ -567,6 +596,19 @@ public Optional findByName(String inName) { return strategyInstanceDao.findByName(inName); } + /** + * Delete all {@link PersistentStrategyMessage} values owned by the given PersistentStrategyInstance. + * + *

This method assumes a transaction set up by the caller.

+ * + * @param inStrategyInstance a PersistentStrategyInstance value + */ + private void deleteAllMessagesFor(PersistentStrategyInstance inStrategyInstance) + { + BooleanBuilder where = new BooleanBuilder(); + where = where.and(QPersistentStrategyMessage.persistentStrategyMessage.strategyInstance.eq(inStrategyInstance)); + strategyMessageDao.deleteAll(strategyMessageDao.findAll(where)); + } /** * Build the sort statement for a query using the given attributes. * @@ -634,11 +676,16 @@ public StrategyInstance getStrategyInstance() return strategyInstance; }} ); + String strategyUsername = strategyInstance.getUser().getName(); // TODO this needs to be configurable - this could be a direct client for DARE or an RPC client for an SE DirectStrategyClient strategyClient = new DirectStrategyClient(newContext, - "trader"); + strategyUsername); beanFactory.registerSingleton(StrategyClient.class.getCanonicalName(), strategyClient); + // get the trade client that we expect to be defined in the parent context + DirectTradeClient tradeClient = applicationContext.getBean(DirectTradeClient.class); + // define the current user, which is the user that owns the strategy + tradeClient.setCurrentUser(strategyInstance); // refresh the context, which allows it to prepare to use the strategy JAR newContext.refresh(); // start the context @@ -646,6 +693,9 @@ public StrategyInstance getStrategyInstance() // start the embedded strategy client strategyClient.start(); } + /** + * Stop the running strategy. + */ private void stop() { try { diff --git a/strategy/strategy-server/src/main/java/org/marketcetera/strategy/dao/PersistentStrategyInstanceFactory.java b/strategy/strategy-server/src/main/java/org/marketcetera/strategy/dao/PersistentStrategyInstanceFactory.java index 675938d78a..09ddb7fa43 100644 --- a/strategy/strategy-server/src/main/java/org/marketcetera/strategy/dao/PersistentStrategyInstanceFactory.java +++ b/strategy/strategy-server/src/main/java/org/marketcetera/strategy/dao/PersistentStrategyInstanceFactory.java @@ -3,6 +3,8 @@ // package org.marketcetera.strategy.dao; +import org.marketcetera.core.Preserve; + /* $License$ */ /** @@ -12,6 +14,7 @@ * @version $Id$ * @since $Release$ */ +@Preserve public class PersistentStrategyInstanceFactory implements org.marketcetera.strategy.StrategyInstanceFactory { @@ -32,8 +35,8 @@ public org.marketcetera.strategy.dao.PersistentStrategyInstance create() * @return an org.marketcetera.strategy.dao.PersistentStrategyInstance value */ @Override - public org.marketcetera.strategy.dao.PersistentStrategyInstance create(org.marketcetera.strategy.StrategyInstance inPersistentStrategyInstance) + public org.marketcetera.strategy.dao.PersistentStrategyInstance create(org.marketcetera.strategy.StrategyInstance inStrategyInstance) { - return new org.marketcetera.strategy.dao.PersistentStrategyInstance(inPersistentStrategyInstance); + return new org.marketcetera.strategy.dao.PersistentStrategyInstance(inStrategyInstance); } } diff --git a/strategy/strategy-server/src/main/java/org/marketcetera/strategy/dao/PersistentStrategyMessage.java b/strategy/strategy-server/src/main/java/org/marketcetera/strategy/dao/PersistentStrategyMessage.java index d2ea1e5c25..6929151fbc 100644 --- a/strategy/strategy-server/src/main/java/org/marketcetera/strategy/dao/PersistentStrategyMessage.java +++ b/strategy/strategy-server/src/main/java/org/marketcetera/strategy/dao/PersistentStrategyMessage.java @@ -3,6 +3,24 @@ // package org.marketcetera.strategy.dao; +import java.util.Date; +import java.util.concurrent.atomic.AtomicLong; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +import org.apache.commons.lang3.StringUtils; +import org.marketcetera.core.Preserve; +import org.marketcetera.core.notifications.INotification; +import org.marketcetera.strategy.HasStrategyInstance; +import org.marketcetera.strategy.StrategyInstance; +import org.marketcetera.strategy.StrategyMessage; + /* $License$ */ /** @@ -12,24 +30,29 @@ * @version $Id$ * @since $Release$ */ -@javax.persistence.Entity(name="StrategyMessage") -@javax.persistence.Table(name="metc_strategy_messages") +@Preserve +@Entity(name="StrategyMessage") +@Table(name="metc_strategy_messages") public class PersistentStrategyMessage extends org.marketcetera.persist.EntityBase - implements org.marketcetera.strategy.StrategyMessage,org.marketcetera.strategy.HasStrategyInstance + implements StrategyMessage,HasStrategyInstance { /** * Create a new PersistentStrategyMessage instance. */ - public PersistentStrategyMessage() {} + public PersistentStrategyMessage() + { + setStrategyMessageId(strategyMessageIdCounter.incrementAndGet()); + } /** * Create a new PersistentStrategyMessage instance. * * @param inStrategyMessage a StrategyMessage value */ - public PersistentStrategyMessage(org.marketcetera.strategy.StrategyMessage inStrategyMessage) + public PersistentStrategyMessage(StrategyMessage inStrategyMessage) { setStrategyInstance(inStrategyMessage.getStrategyInstance()); + setStrategyMessageId(inStrategyMessage.getStrategyMessageId()); setMessageTimestamp(inStrategyMessage.getMessageTimestamp()); setSeverity(inStrategyMessage.getSeverity()); setMessage(inStrategyMessage.getMessage()); @@ -37,60 +60,60 @@ public PersistentStrategyMessage(org.marketcetera.strategy.StrategyMessage inStr /** * Get the strategyInstance value. * - * @return an org.marketcetera.strategy.StrategyInstance value + * @return an StrategyInstance value */ @Override - public org.marketcetera.strategy.StrategyInstance getStrategyInstance() + public StrategyInstance getStrategyInstance() { return strategyInstance; } /** * Set the strategyInstance value. * - * @param inStrategyInstance an org.marketcetera.strategy.StrategyInstance value + * @param inStrategyInstance an StrategyInstance value */ @Override - public void setStrategyInstance(org.marketcetera.strategy.StrategyInstance inStrategyInstance) + public void setStrategyInstance(StrategyInstance inStrategyInstance) { - strategyInstance = (org.marketcetera.strategy.dao.PersistentStrategyInstance)inStrategyInstance; + strategyInstance = (PersistentStrategyInstance)inStrategyInstance; } /** * Get the messageTimestamp value. * - * @return a java.util.Date value + * @return a Date value */ @Override - public java.util.Date getMessageTimestamp() + public Date getMessageTimestamp() { return messageTimestamp; } /** * Set the messageTimestamp value. * - * @param inMessageTimestamp a java.util.Date value + * @param inMessageTimestamp a Date value */ @Override - public void setMessageTimestamp(java.util.Date inMessageTimestamp) + public void setMessageTimestamp(Date inMessageTimestamp) { messageTimestamp = inMessageTimestamp; } /** * Get the severity value. * - * @return an org.marketcetera.core.notifications.INotification.Severity value + * @return an INotification.Severity value */ @Override - public org.marketcetera.core.notifications.INotification.Severity getSeverity() + public INotification.Severity getSeverity() { return severity; } /** * Set the severity value. * - * @param inSeverity an org.marketcetera.core.notifications.INotification.Severity value + * @param inSeverity an INotification.Severity value */ @Override - public void setSeverity(org.marketcetera.core.notifications.INotification.Severity inSeverity) + public void setSeverity(INotification.Severity inSeverity) { severity = inSeverity; } @@ -112,7 +135,24 @@ public String getMessage() @Override public void setMessage(String inMessage) { - message = org.apache.commons.lang.StringUtils.trimToNull(inMessage); + message = StringUtils.trimToNull(inMessage); + } + /* (non-Javadoc) + * @see StrategyMessage#getStrategyMessageId() + */ + @Override + public long getStrategyMessageId() + { + return strategyMessageId; + } + /** + * Sets the strategyMessageId value. + * + * @param inStrategyMessageId a long value + */ + public void setStrategyMessageId(long inStrategyMessageId) + { + strategyMessageId = inStrategyMessageId; } /* (non-Javadoc) * @see java.lang.Object#toString() @@ -122,32 +162,43 @@ public String toString() { StringBuilder builder = new StringBuilder(); builder.append("StrategyMessage [") - .append("strategyInstance=").append(strategyInstance) + .append("strategyMessageId=").append(getId()) + .append(", strategyInstance=").append(strategyInstance) .append(", messageTimestamp=").append(messageTimestamp) .append(", severity=").append(severity) .append(", message=").append(message).append("]"); return builder.toString(); } + /** + * provides a source for unique message ids + */ + private static final AtomicLong strategyMessageIdCounter = new AtomicLong(System.currentTimeMillis()); + /** + * unique identifies the strategy message + */ + @Column(name="strategy_message_id",nullable=false,unique=true) + private long strategyMessageId; /** * strategy which created this message */ - @javax.persistence.ManyToOne - @javax.persistence.JoinColumn(name="strategy_instance_id",nullable=true) - private org.marketcetera.strategy.dao.PersistentStrategyInstance strategyInstance; + @ManyToOne + @JoinColumn(name="strategy_instance_id",nullable=true) + private PersistentStrategyInstance strategyInstance; /** * date message was created */ - @javax.persistence.Column(name="message_timestamp",nullable=true,unique=false) - private java.util.Date messageTimestamp; + @Column(name="message_timestamp",nullable=true,unique=false) + private Date messageTimestamp; /** * strategy message severity */ - @javax.persistence.Column(name="severity",nullable=true,unique=false) - private org.marketcetera.core.notifications.INotification.Severity severity; + @Enumerated(EnumType.STRING) + @Column(name="severity",nullable=true,unique=false) + private INotification.Severity severity; /** * message from the strategy */ - @javax.persistence.Column(name="message",nullable=true,unique=false) + @Column(name="message",nullable=true,unique=false) private String message; private static final long serialVersionUID = 1444495066L; } diff --git a/strategy/strategy-server/src/main/java/org/marketcetera/strategy/dao/PersistentStrategyMessageFactory.java b/strategy/strategy-server/src/main/java/org/marketcetera/strategy/dao/PersistentStrategyMessageFactory.java index 361c4f2dcf..0a5716d202 100644 --- a/strategy/strategy-server/src/main/java/org/marketcetera/strategy/dao/PersistentStrategyMessageFactory.java +++ b/strategy/strategy-server/src/main/java/org/marketcetera/strategy/dao/PersistentStrategyMessageFactory.java @@ -3,6 +3,10 @@ // package org.marketcetera.strategy.dao; +import org.marketcetera.core.Preserve; +import org.marketcetera.strategy.StrategyMessage; +import org.marketcetera.strategy.StrategyMessageFactory; + /* $License$ */ /** @@ -12,28 +16,29 @@ * @version $Id$ * @since $Release$ */ +@Preserve public class PersistentStrategyMessageFactory - implements org.marketcetera.strategy.StrategyMessageFactory + implements StrategyMessageFactory { /** - * Create a new org.marketcetera.strategy.dao.PersistentStrategyMessage instance. + * Create a new PersistentStrategyMessage instance. * - * @return a org.marketcetera.strategy.dao.PersistentStrategyMessage value + * @return a PersistentStrategyMessage value */ @Override - public org.marketcetera.strategy.dao.PersistentStrategyMessage create() + public PersistentStrategyMessage create() { - return new org.marketcetera.strategy.dao.PersistentStrategyMessage(); + return new PersistentStrategyMessage(); } /** - * Create a new org.marketcetera.strategy.dao.PersistentStrategyMessage instance from the given object. + * Create a new PersistentStrategyMessage instance from the given object. * - * @param inStrategyMessage an org.marketcetera.strategy.dao.PersistentStrategyMessage value - * @return an org.marketcetera.strategy.dao.PersistentStrategyMessage value + * @param inStrategyMessage an PersistentStrategyMessage value + * @return a PersistentStrategyMessage value */ @Override - public org.marketcetera.strategy.dao.PersistentStrategyMessage create(org.marketcetera.strategy.StrategyMessage inPersistentStrategyMessage) + public PersistentStrategyMessage create(StrategyMessage inStrategyMessage) { - return new org.marketcetera.strategy.dao.PersistentStrategyMessage(inPersistentStrategyMessage); + return new PersistentStrategyMessage(inStrategyMessage); } } diff --git a/strategy/strategy-server/src/main/java/org/marketcetera/strategy/dao/StrategyMessageDao.java b/strategy/strategy-server/src/main/java/org/marketcetera/strategy/dao/StrategyMessageDao.java index bb372d743c..ab5ce4b81c 100644 --- a/strategy/strategy-server/src/main/java/org/marketcetera/strategy/dao/StrategyMessageDao.java +++ b/strategy/strategy-server/src/main/java/org/marketcetera/strategy/dao/StrategyMessageDao.java @@ -3,6 +3,10 @@ // package org.marketcetera.strategy.dao; +import java.util.Optional; + +import org.marketcetera.core.Preserve; + /* $License$ */ /** @@ -12,7 +16,15 @@ * @version $Id$ * @since $Release$ */ +@Preserve public interface StrategyMessageDao extends org.springframework.data.jpa.repository.JpaRepository,org.springframework.data.querydsl.QuerydslPredicateExecutor { + /** + * Find the strategy message by the given strategy message id, if possible. + * + * @param inStrategyMessageId a long value + * @return an Optional<PersistentStrategyMessage> value + */ + Optional findByStrategyMessageId(long inStrategyMessageId); } diff --git a/trade/trade-api/.gitignore b/trade/trade-api/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/trade/trade-api/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/trade/trade-api/src/main/java/org/marketcetera/trade/SuggestionListener.java b/trade/trade-api/src/main/java/org/marketcetera/trade/SuggestionListener.java new file mode 100644 index 0000000000..a0fbf0bb22 --- /dev/null +++ b/trade/trade-api/src/main/java/org/marketcetera/trade/SuggestionListener.java @@ -0,0 +1,20 @@ +package org.marketcetera.trade; + +/* $License$ */ + +/** + * Listens for trade suggestions. + * + * @author Colin DuPlantis + * @version $Id$ + * @since $Release$ + */ +public interface SuggestionListener +{ + /** + * Receive a trade suggestion. + * + * @param inSuggestion a Suggestion value + */ + void receiveSuggestion(Suggestion inSuggestion); +} diff --git a/trade/trade-api/src/main/java/org/marketcetera/trade/TradePermissions.java b/trade/trade-api/src/main/java/org/marketcetera/trade/TradePermissions.java index 13269041df..326fdbb3d7 100644 --- a/trade/trade-api/src/main/java/org/marketcetera/trade/TradePermissions.java +++ b/trade/trade-api/src/main/java/org/marketcetera/trade/TradePermissions.java @@ -15,6 +15,8 @@ public enum TradePermissions implements GrantedAuthority { SendOrderAction, + SendSuggestionAction, + ViewSuggestionsAction, ViewOpenOrdersAction, ViewReportAction, ViewPositionAction, diff --git a/trade/trade-api/src/main/java/org/marketcetera/trade/client/TradeClient.java b/trade/trade-api/src/main/java/org/marketcetera/trade/client/TradeClient.java index fc38aa6b6f..c68f9d928b 100644 --- a/trade/trade-api/src/main/java/org/marketcetera/trade/client/TradeClient.java +++ b/trade/trade-api/src/main/java/org/marketcetera/trade/client/TradeClient.java @@ -23,6 +23,8 @@ import org.marketcetera.trade.OrderSummary; import org.marketcetera.trade.Report; import org.marketcetera.trade.ReportID; +import org.marketcetera.trade.Suggestion; +import org.marketcetera.trade.SuggestionListener; import org.marketcetera.trade.TradeMessagePublisher; /* $License$ */ @@ -63,6 +65,12 @@ public interface TradeClient * @return a List<SendOrderResponse> value */ List sendOrders(List inOrders); + /** + * Submit a trade suggestion. + * + * @param inSuggestion a Suggestion value + */ + void sendOrderSuggestion(Suggestion inSuggestion); /** * Submit the given order. * @@ -90,7 +98,7 @@ BigDecimal getPositionAsOf(Date inDate, * Returns all positions of options with the given root symbols based on reports generated and received on or before the supplied date in UTC. * * @param inDate a Date value - * @param inRootElements a String[] value + * @param inRootSymbols a String[] value * @return a Map<PositionKey<Optiont>,BigDecimal> value */ Map,BigDecimal> getOptionPositionsAsOf(Date inDate, @@ -181,4 +189,16 @@ void addReport(HasFIXMessage inReport, * @return a CollectionPageResponse<AveragePriceFill> value */ CollectionPageResponse getAveragePriceFills(PageRequest inPageRequest); + /** + * Add the given suggestion listener. + * + * @param inSuggestionListener a SuggestionListener value + */ + void addSuggestionListener(SuggestionListener inSuggestionListener); + /** + * Remove the given suggestion listener. + * + * @param inSuggestionListener a SuggestionListener value + */ + void removeSuggestionListener(SuggestionListener inSuggestionListener); } diff --git a/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/CurrentPositionFactory.java b/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/CurrentPositionFactory.java index 5d282e69a7..9cb5c1e69f 100644 --- a/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/CurrentPositionFactory.java +++ b/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/CurrentPositionFactory.java @@ -3,6 +3,9 @@ // package org.marketcetera.trade.pnl; +import org.marketcetera.core.Factory; +import org.marketcetera.core.Preserve; + /* $License$ */ /** @@ -12,8 +15,9 @@ * @version $Id$ * @since $Release$ */ +@Preserve public interface CurrentPositionFactory - extends org.marketcetera.core.Factory + extends Factory { /** * Create a new CurrentPosition instance. @@ -25,7 +29,7 @@ public interface CurrentPositionFactory /** * Create a new CurrentPosition instance from the given object. * - * @param inObject a CurrentPosition value + * @param inCurrentPosition a CurrentPosition value * @return a CurrentPosition value */ @Override diff --git a/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/LotFactory.java b/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/LotFactory.java index 9f84d04d03..9b15496856 100644 --- a/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/LotFactory.java +++ b/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/LotFactory.java @@ -3,6 +3,9 @@ // package org.marketcetera.trade.pnl; +import org.marketcetera.core.Factory; +import org.marketcetera.core.Preserve; + /* $License$ */ /** @@ -12,8 +15,9 @@ * @version $Id$ * @since $Release$ */ +@Preserve public interface LotFactory - extends org.marketcetera.core.Factory + extends Factory { /** * Create a new Lot instance. @@ -25,7 +29,7 @@ public interface LotFactory /** * Create a new Lot instance from the given object. * - * @param inObject a Lot value + * @param inLot a Lot value * @return a Lot value */ @Override diff --git a/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/PositionFactory.java b/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/PositionFactory.java index 74701e33f4..7e87d20955 100644 --- a/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/PositionFactory.java +++ b/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/PositionFactory.java @@ -3,6 +3,9 @@ // package org.marketcetera.trade.pnl; +import org.marketcetera.core.Factory; +import org.marketcetera.core.Preserve; + /* $License$ */ /** @@ -12,8 +15,9 @@ * @version $Id$ * @since $Release$ */ +@Preserve public interface PositionFactory - extends org.marketcetera.core.Factory + extends Factory { /** * Create a new Position instance. @@ -25,7 +29,7 @@ public interface PositionFactory /** * Create a new Position instance from the given object. * - * @param inObject a Position value + * @param inPosition a Position value * @return a Position value */ @Override diff --git a/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/ProfitAndLossFactory.java b/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/ProfitAndLossFactory.java index 1ff745ee4f..3fcca6cf5b 100644 --- a/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/ProfitAndLossFactory.java +++ b/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/ProfitAndLossFactory.java @@ -3,6 +3,9 @@ // package org.marketcetera.trade.pnl; +import org.marketcetera.core.Factory; +import org.marketcetera.core.Preserve; + /* $License$ */ /** @@ -12,8 +15,9 @@ * @version $Id$ * @since $Release$ */ +@Preserve public interface ProfitAndLossFactory - extends org.marketcetera.core.Factory + extends Factory { /** * Create a new ProfitAndLoss instance. @@ -25,7 +29,7 @@ public interface ProfitAndLossFactory /** * Create a new ProfitAndLoss instance from the given object. * - * @param inObject a ProfitAndLoss value + * @param inProfitAndLoss a ProfitAndLoss value * @return a ProfitAndLoss value */ @Override diff --git a/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/TradeFactory.java b/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/TradeFactory.java index 1f3adbd144..55422d9988 100644 --- a/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/TradeFactory.java +++ b/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/TradeFactory.java @@ -3,6 +3,9 @@ // package org.marketcetera.trade.pnl; +import org.marketcetera.core.Factory; +import org.marketcetera.core.Preserve; + /* $License$ */ /** @@ -12,8 +15,9 @@ * @version $Id$ * @since $Release$ */ +@Preserve public interface TradeFactory - extends org.marketcetera.core.Factory + extends Factory { /** * Create a new Trade instance. @@ -25,7 +29,7 @@ public interface TradeFactory /** * Create a new Trade instance from the given object. * - * @param inObject a Trade value + * @param inTrade a Trade value * @return a Trade value */ @Override diff --git a/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/TradePnlClient.java b/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/TradePnlClient.java index b2061529d5..2b0d836d7f 100644 --- a/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/TradePnlClient.java +++ b/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/TradePnlClient.java @@ -3,6 +3,11 @@ // package org.marketcetera.trade.pnl; +import org.marketcetera.core.Preserve; +import org.marketcetera.persist.PageRequest; +import org.marketcetera.trade.Instrument; +import org.marketcetera.trade.UserID; + /* $License$ */ /** @@ -12,24 +17,28 @@ * @version $Id$ * @since $Release$ */ +@Preserve public interface TradePnlClient extends org.marketcetera.core.BaseClient { /** * Requests positions for a user. * - * @param inUserID a org.marketcetera.trade.UserID value - * @param inPageRequest a org.marketcetera.persist.PageRequest value - * @returns a org.marketcetera.trade.pnl.CurrentPosition value + * @param inUserID a UserID value + * @param inPageRequest a PageRequest value + * @return a CurrentPosition value */ - org.marketcetera.trade.pnl.CurrentPosition getCurrentPositions(org.marketcetera.trade.UserID inUserID,org.marketcetera.persist.PageRequest inPageRequest); + CurrentPosition getCurrentPositions(UserID inUserID, + PageRequest inPageRequest); /** * Requests profit and loss for a user and an instrument. * - * @param inUserID a org.marketcetera.trade.UserID value - * @param inInstrument a org.marketcetera.trade.Instrument value - * @param inPageRequest a org.marketcetera.persist.PageRequest value - * @returns a org.marketcetera.trade.pnl.ProfitAndLoss value + * @param inUserID a UserID value + * @param inInstrument a Instrument value + * @param inPageRequest a PageRequest value + * @return a ProfitAndLoss value */ - org.marketcetera.trade.pnl.ProfitAndLoss getProfitAndLoss(org.marketcetera.trade.UserID inUserID,org.marketcetera.trade.Instrument inInstrument,org.marketcetera.persist.PageRequest inPageRequest); + ProfitAndLoss getProfitAndLoss(UserID inUserID, + Instrument inInstrument, + PageRequest inPageRequest); } diff --git a/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/TradePnlService.java b/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/TradePnlService.java index ca7c474fa3..2564aa4804 100644 --- a/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/TradePnlService.java +++ b/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/TradePnlService.java @@ -3,6 +3,12 @@ // package org.marketcetera.trade.pnl; +import org.marketcetera.core.Preserve; +import org.marketcetera.persist.CollectionPageResponse; +import org.marketcetera.persist.PageRequest; +import org.marketcetera.trade.Instrument; +import org.marketcetera.trade.UserID; + /* $License$ */ /** @@ -12,23 +18,27 @@ * @version $Id$ * @since $Release$ */ +@Preserve public interface TradePnlService { /** * Requests positions for a user. * - * @param inUserID a org.marketcetera.trade.UserID value - * @param inPageRequest a org.marketcetera.persist.PageRequest value - * @returns a org.marketcetera.trade.pnl.CurrentPosition value + * @param inUserID a UserID value + * @param inPageRequest a PageRequest value + * @return a CollectionPageResponse<CurrentPosition> value */ - org.marketcetera.persist.CollectionPageResponse getCurrentPositions(org.marketcetera.trade.UserID inUserID,org.marketcetera.persist.PageRequest inPageRequest); + CollectionPageResponse getCurrentPositions(UserID inUserID, + PageRequest inPageRequest); /** * Requests profit and loss for a user and an instrument. * - * @param inUserID a org.marketcetera.trade.UserID value - * @param inInstrument a org.marketcetera.trade.Instrument value - * @param inPageRequest a org.marketcetera.persist.PageRequest value - * @returns a org.marketcetera.trade.pnl.ProfitAndLoss value + * @param inUserID a UserID value + * @param inInstrument a Instrument value + * @param inPageRequest a PageRequest value + * @return a CollectionPageResponse<ProfitAndLoss> value */ - org.marketcetera.persist.CollectionPageResponse getProfitAndLoss(org.marketcetera.trade.UserID inUserID,org.marketcetera.trade.Instrument inInstrument,org.marketcetera.persist.PageRequest inPageRequest); + CollectionPageResponse getProfitAndLoss(UserID inUserID, + Instrument inInstrument, + PageRequest inPageRequest); } diff --git a/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/UserTradeFactory.java b/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/UserTradeFactory.java index 8d22e9c9f0..b229ef1382 100644 --- a/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/UserTradeFactory.java +++ b/trade/trade-api/src/main/java/org/marketcetera/trade/pnl/UserTradeFactory.java @@ -3,6 +3,9 @@ // package org.marketcetera.trade.pnl; +import org.marketcetera.core.Factory; +import org.marketcetera.core.Preserve; + /* $License$ */ /** @@ -12,8 +15,9 @@ * @version $Id$ * @since $Release$ */ +@Preserve public interface UserTradeFactory - extends org.marketcetera.core.Factory + extends Factory { /** * Create a new UserTrade instance. @@ -25,7 +29,7 @@ public interface UserTradeFactory /** * Create a new UserTrade instance from the given object. * - * @param inObject a UserTrade value + * @param inUserTrade a UserTrade value * @return a UserTrade value */ @Override diff --git a/trade/trade-api/src/main/java/org/marketcetera/trade/service/ReportService.java b/trade/trade-api/src/main/java/org/marketcetera/trade/service/ReportService.java index 74d7b0de66..daa5e88012 100644 --- a/trade/trade-api/src/main/java/org/marketcetera/trade/service/ReportService.java +++ b/trade/trade-api/src/main/java/org/marketcetera/trade/service/ReportService.java @@ -325,7 +325,7 @@ Page getExecutions(int inPageNumber, * * @param inMessage a HasFIXMessage value * @param inBrokerID a BrokerID value - * @param inUserID a UserID value + * @param inUserId a UserID value */ void addReport(HasFIXMessage inMessage, BrokerID inBrokerID, diff --git a/trade/trade-api/src/main/java/org/marketcetera/trade/service/TradeService.java b/trade/trade-api/src/main/java/org/marketcetera/trade/service/TradeService.java index 431f2679fc..319fdcfd43 100644 --- a/trade/trade-api/src/main/java/org/marketcetera/trade/service/TradeService.java +++ b/trade/trade-api/src/main/java/org/marketcetera/trade/service/TradeService.java @@ -6,11 +6,11 @@ import org.marketcetera.fix.ServerFixSession; import org.marketcetera.trade.MessageCreationException; import org.marketcetera.trade.Order; +import org.marketcetera.trade.Suggestion; +import org.marketcetera.trade.SuggestionListener; import org.marketcetera.trade.TradeMessage; import org.marketcetera.trade.TradeMessagePublisher; -import quickfix.Message; - /* $License$ */ /** @@ -28,7 +28,6 @@ public interface TradeService * * @param inOrder an Order value * @return a ServerFixSession value - * @throws NoBrokerSelected if a session could not be determined */ ServerFixSession selectServerFixSession(Order inOrder); /** @@ -36,12 +35,10 @@ public interface TradeService * * @param inOrder an Order value * @param inServerFixSession a ServerFixSession value - * @return a Message value - * @throws BrokerUnavailable if the broker is unavailable or unknown - * @throws MessageIntercepted if the order should not be sent on in the data flow + * @return a quickfix.Message value */ - Message convertOrder(Order inOrder, - ServerFixSession inServerFixSession); + quickfix.Message convertOrder(Order inOrder, + ServerFixSession inServerFixSession); /** * Convert the given message from the given broker to a TradeMessage. * @@ -61,4 +58,22 @@ TradeMessage convertResponse(HasFIXMessage inMessage, */ void sendOrder(User inUser, Order inOrder); + /** + * Add the given trade message listener. + * + * @param inSuggestionListener a SuggestionListener value + */ + void addSuggestionListener(SuggestionListener inSuggestionListener); + /** + * Remove the given trade message listener. + * + * @param inSuggestionListener a SuggestionListener value + */ + void removeSuggestionListener(SuggestionListener inSuggestionListener); + /** + * Report a suggestion to be broadcast. + * + * @param inSuggestion a Suggestion value + */ + void reportSuggestion(Suggestion inSuggestion); } diff --git a/trade/trade-core/.gitignore b/trade/trade-core/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/trade/trade-core/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/trade/trade-core/src/main/java/org/marketcetera/client/instruments/CurrencyValidationHandler.java b/trade/trade-core/src/main/java/org/marketcetera/client/instruments/CurrencyValidationHandler.java index 427ebf923d..7324d57286 100644 --- a/trade/trade-core/src/main/java/org/marketcetera/client/instruments/CurrencyValidationHandler.java +++ b/trade/trade-core/src/main/java/org/marketcetera/client/instruments/CurrencyValidationHandler.java @@ -11,8 +11,6 @@ /** * A class that perform currency validation functions. * - * @param The type of instrument handled by this function - * */ @ClassVersion("$Id: CurrencyValidationHandler") public class CurrencyValidationHandler extends InstrumentValidationHandler{ diff --git a/trade/trade-core/src/main/java/org/marketcetera/client/instruments/OptionValidationHandler.java b/trade/trade-core/src/main/java/org/marketcetera/client/instruments/OptionValidationHandler.java index e5e35e03ab..0f57d4ba82 100644 --- a/trade/trade-core/src/main/java/org/marketcetera/client/instruments/OptionValidationHandler.java +++ b/trade/trade-core/src/main/java/org/marketcetera/client/instruments/OptionValidationHandler.java @@ -47,13 +47,10 @@ public void validate(Instrument instrument) throws OrderValidationException { * * where: *
    - * YYYY: represents the year - *
    - * MM: represents the month: 01-12 - *
    - * DD: represents the day of the month: 01-31 - *
    - * wN: represents the week number: w1-w5 + *
  • YYYY: represents the year
  • + *
  • MM: represents the month: 01-12
  • + *
  • DD: represents the day of the month: 01-31
  • + *
  • wN: represents the week number: w1-w5
  • *
* * @param inExpiry the expiry field of the option diff --git a/trade/trade-core/src/main/java/org/marketcetera/client/utils/AutoOrderHistoryManager.java b/trade/trade-core/src/main/java/org/marketcetera/client/utils/AutoOrderHistoryManager.java index 1699b00a92..491d6b508d 100644 --- a/trade/trade-core/src/main/java/org/marketcetera/client/utils/AutoOrderHistoryManager.java +++ b/trade/trade-core/src/main/java/org/marketcetera/client/utils/AutoOrderHistoryManager.java @@ -2,7 +2,6 @@ import java.util.Date; -import org.marketcetera.trade.ReportBase; import org.marketcetera.trade.TradeMessage; import org.marketcetera.trade.TradeMessageListener; import org.marketcetera.trade.utils.OrderHistoryManager; @@ -18,7 +17,7 @@ * to look for order history. * *

This class will receive new reports on its own - it is not necessary nor is it permitted to manually - * {@link #add(ReportBase) add reports}. + * {@link #add(TradeMessage) add reports}. * *

Note that there are significant performance and resource implications when using this class. * Depending on historical order volume, this class may be required to process thousands or millions diff --git a/trade/trade-core/src/main/java/org/marketcetera/core/instruments/InstrumentFromMessage.java b/trade/trade-core/src/main/java/org/marketcetera/core/instruments/InstrumentFromMessage.java index f6dcb70771..40b82269d4 100644 --- a/trade/trade-core/src/main/java/org/marketcetera/core/instruments/InstrumentFromMessage.java +++ b/trade/trade-core/src/main/java/org/marketcetera/core/instruments/InstrumentFromMessage.java @@ -13,10 +13,7 @@ * from a FIX message. *

* Typical usage is - *

- * quickfix.Message message =...
- * {@link InstrumentFromMessage}.{@link #SELECTOR}.{@link DynamicInstrumentFunctionSelector#forValue(Object) forValue}(message).{@link #extract(quickfix.Message) extract}(message);
- * 
+ *
Instrument instrument = InstrumentFromMessage.SELECTOR.forValue(quickfix.Message).extract(quickfix.Message);
* * @author anshul@marketcetera.com * @version $Id$ diff --git a/trade/trade-core/src/main/java/org/marketcetera/core/instruments/InstrumentToMessage.java b/trade/trade-core/src/main/java/org/marketcetera/core/instruments/InstrumentToMessage.java index 05ebb567be..26163a953f 100644 --- a/trade/trade-core/src/main/java/org/marketcetera/core/instruments/InstrumentToMessage.java +++ b/trade/trade-core/src/main/java/org/marketcetera/core/instruments/InstrumentToMessage.java @@ -6,7 +6,6 @@ import quickfix.DataDictionary; import quickfix.FieldMap; -import quickfix.Message; import quickfix.field.SecurityType; import quickfix.field.Symbol; @@ -16,16 +15,7 @@ * instrument onto the supplied FIX message. *

* Typical usage is: - *

- * Instrument instrument = ...
- * quickfix.DataDictionary dataDictionary = ...
- * String msgType = ...
- * quickfix.Message message = ...
- * InstrumentToMessage itm = {@link InstrumentToMessage}.{@link #SELECTOR}.{@link StaticInstrumentFunctionSelector#forInstrument(Instrument) forInstrument}(instrument);
- * if(itm.{@link #isSupported(quickfix.DataDictionary, String) isSupported}(dataDictionary,msgType)) {
- *     itm.{@link #set(Instrument, DataDictionary, String, Message) set}(instrument, dataDictionary, msgType, message);
- * }
- * 
+ *
InstrumentToMessage.SELECTOR.forInstrument(instrument).set(instrument,mMessageFactory.getBeginString(),quickfixMessage);
* * @param The type of instrument handled by this function * @@ -45,7 +35,7 @@ public abstract class InstrumentToMessage extends Instrume *

* NOTE: This method is only meant to be used for unit testing. * It's not recommended that this method be used in production. Use - * {@link #set(org.marketcetera.trade.Instrument,quickfix.DataDictionary, String,quickfix.Message)} instead. + * {@link #set(Instrument, String, quickfix.FieldMap)} instead. * * @param inInstrument the instrument * @param inBeginString the begin string value of the FIX message diff --git a/trade/trade-core/src/main/java/org/marketcetera/core/instruments/package-info.java b/trade/trade-core/src/main/java/org/marketcetera/core/instruments/package-info.java deleted file mode 100644 index 670dfa9479..0000000000 --- a/trade/trade-core/src/main/java/org/marketcetera/core/instruments/package-info.java +++ /dev/null @@ -1,63 +0,0 @@ -/* $License$ */ -/** - * Provides mechanisms to abstract out instrument specific functionality in - * the system. - *

- * Two types of abstractions are available. - *

    - *
  1. {@link org.marketcetera.core.instruments.InstrumentFunctionHandler}: For carrying out instrument - * specific functions when an instrument instance is available.
  2. - *
  3. {@link org.marketcetera.core.instruments.DynamicInstrumentHandler}: For carrying out - * instrument specific functions when an instrument instance is not available - * but some other data is available from which the instrument type can be - * determined.
  4. - *
- *

InstrumentFunctionHandler

- *

- * Any instrument specific functionality that needs to be performed when an - * instrument instance is available is abstracted out by - * implementing it in a subclass of - * {@link org.marketcetera.core.instruments.InstrumentFunctionHandler}. - *

- * A {@link org.marketcetera.core.instruments.StaticInstrumentFunctionSelector} - * instance can be used to dynamically select the appropriate handler - * instance for an instrument via - * {@link org.marketcetera.core.instruments.StaticInstrumentFunctionSelector#forInstrument(org.marketcetera.trade.Instrument)}. - * The selector chooses the appropriate instrument specific subclass of - * {@link org.marketcetera.core.instruments.StaticInstrumentFunctionSelector} - * based on the runtime type of the instrument. - *

- * See {@link org.marketcetera.core.instruments.InstrumentToMessage} for an - * example. - *

- *

DynamicInstrumentHandler

- * In cases when an instrument instance is not available and instrument - * specific functionality needs to be invoked based on an arbitrary data, - * a combination of {@link org.marketcetera.core.instruments.DynamicInstrumentFunctionSelector} - * & {@link org.marketcetera.core.instruments.DynamicInstrumentHandler} is - * used. These classes help dynamically select the instrument specific - * functionality in absence of the Instrument object. See - * {@link org.marketcetera.core.instruments.InstrumentFromMessage} - * for an example. - *

Available Handlers

- * The following handlers are available for extraction and insertion of - * instruments from / in to FIX messages. - *
    - *
  1. {@link org.marketcetera.core.instruments.InstrumentToMessage}: - * Sets the fields corresponding to an instrument on a FIX message
  2. - *
  3. {@link org.marketcetera.core.instruments.InstrumentFromMessage}: - * Extracts an instrument from a FIX message
  4. - *
- *

packaging

- * The {@link java.util.ServiceLoader} class is used to dynamically - * discover and load instrument specific functions. A - * file in META-INF/services is created for each instrument - * specific platform function. The file contains the names of classes - * that implement the instrument specific function for each instrument type. - * See {@link java.util.ServiceLoader} documentation for more details. - * - * @author anshul@marketcetera.com - * @version $Id$ - * @since 2.0.0 - */ -package org.marketcetera.core.instruments; \ No newline at end of file diff --git a/trade/trade-core/src/main/java/org/marketcetera/trade/event/SimpleIncomingMessageInterceptedEvent.java b/trade/trade-core/src/main/java/org/marketcetera/trade/event/SimpleIncomingMessageInterceptedEvent.java index 5fb49ac66f..76be0e2f3a 100644 --- a/trade/trade-core/src/main/java/org/marketcetera/trade/event/SimpleIncomingMessageInterceptedEvent.java +++ b/trade/trade-core/src/main/java/org/marketcetera/trade/event/SimpleIncomingMessageInterceptedEvent.java @@ -3,7 +3,7 @@ /* $License$ */ /** - * Provides a POJO {@link IncomingMessageIntercetedEvent}. + * Provides a POJO {@link IncomingMessageInterceptedEvent}. * * @author Colin DuPlantis * @version $Id$ diff --git a/trade/trade-core/src/main/java/org/marketcetera/trade/event/SimpleOutgoingMessageInterceptedEvent.java b/trade/trade-core/src/main/java/org/marketcetera/trade/event/SimpleOutgoingMessageInterceptedEvent.java index 939f6716a3..1e2dc55c9c 100644 --- a/trade/trade-core/src/main/java/org/marketcetera/trade/event/SimpleOutgoingMessageInterceptedEvent.java +++ b/trade/trade-core/src/main/java/org/marketcetera/trade/event/SimpleOutgoingMessageInterceptedEvent.java @@ -3,7 +3,7 @@ /* $License$ */ /** - * Provides a POJO {@link OutgoingMessageIntercetedEvent}. + * Provides a POJO {@link OutgoingMessageInterceptedEvent}. * * @author Colin DuPlantis * @version $Id$ diff --git a/trade/trade-core/src/main/java/org/marketcetera/trade/pnl/SimpleCurrentPositionFactory.java b/trade/trade-core/src/main/java/org/marketcetera/trade/pnl/SimpleCurrentPositionFactory.java index 36ce6e688e..f8cba4c727 100644 --- a/trade/trade-core/src/main/java/org/marketcetera/trade/pnl/SimpleCurrentPositionFactory.java +++ b/trade/trade-core/src/main/java/org/marketcetera/trade/pnl/SimpleCurrentPositionFactory.java @@ -3,6 +3,8 @@ // package org.marketcetera.trade.pnl; +import org.marketcetera.core.Preserve; + /* $License$ */ /** @@ -12,28 +14,29 @@ * @version $Id$ * @since $Release$ */ +@Preserve public class SimpleCurrentPositionFactory - implements org.marketcetera.trade.pnl.CurrentPositionFactory + implements CurrentPositionFactory { /** - * Create a new org.marketcetera.trade.pnl.SimpleCurrentPosition instance. + * Create a new SimpleCurrentPosition instance. * - * @return a org.marketcetera.trade.pnl.SimpleCurrentPosition value + * @return a SimpleCurrentPosition value */ @Override - public org.marketcetera.trade.pnl.SimpleCurrentPosition create() + public SimpleCurrentPosition create() { - return new org.marketcetera.trade.pnl.SimpleCurrentPosition(); + return new SimpleCurrentPosition(); } /** - * Create a new org.marketcetera.trade.pnl.SimpleCurrentPosition instance from the given object. + * Create a new SimpleCurrentPosition instance from the given object. * - * @param inObject a org.marketcetera.trade.pnl.SimpleCurrentPosition value - * @return a org.marketcetera.trade.pnl.SimpleCurrentPosition value + * @param inSimpleCurrentPosition a SimpleCurrentPosition value + * @return a SimpleCurrentPosition value */ @Override - public org.marketcetera.trade.pnl.SimpleCurrentPosition create(org.marketcetera.trade.pnl.CurrentPosition inSimpleCurrentPosition) + public SimpleCurrentPosition create(CurrentPosition inSimpleCurrentPosition) { - return new org.marketcetera.trade.pnl.SimpleCurrentPosition(inSimpleCurrentPosition); + return new SimpleCurrentPosition(inSimpleCurrentPosition); } } diff --git a/trade/trade-core/src/main/java/org/marketcetera/trade/pnl/SimpleLotFactory.java b/trade/trade-core/src/main/java/org/marketcetera/trade/pnl/SimpleLotFactory.java index 53b26ba129..3148e2e6f8 100644 --- a/trade/trade-core/src/main/java/org/marketcetera/trade/pnl/SimpleLotFactory.java +++ b/trade/trade-core/src/main/java/org/marketcetera/trade/pnl/SimpleLotFactory.java @@ -3,6 +3,8 @@ // package org.marketcetera.trade.pnl; +import org.marketcetera.core.Preserve; + /* $License$ */ /** @@ -12,28 +14,29 @@ * @version $Id$ * @since $Release$ */ +@Preserve public class SimpleLotFactory - implements org.marketcetera.trade.pnl.LotFactory + implements LotFactory { /** - * Create a new org.marketcetera.trade.pnl.SimpleLot instance. + * Create a new SimpleLot instance. * - * @return a org.marketcetera.trade.pnl.SimpleLot value + * @return a SimpleLot value */ @Override - public org.marketcetera.trade.pnl.SimpleLot create() + public SimpleLot create() { - return new org.marketcetera.trade.pnl.SimpleLot(); + return new SimpleLot(); } /** - * Create a new org.marketcetera.trade.pnl.SimpleLot instance from the given object. + * Create a new SimpleLot instance from the given object. * - * @param inObject a org.marketcetera.trade.pnl.SimpleLot value - * @return a org.marketcetera.trade.pnl.SimpleLot value + * @param inLot a SimpleLot value + * @return a SimpleLot value */ @Override - public org.marketcetera.trade.pnl.SimpleLot create(org.marketcetera.trade.pnl.Lot inSimpleLot) + public SimpleLot create(Lot inLot) { - return new org.marketcetera.trade.pnl.SimpleLot(inSimpleLot); + return new SimpleLot(inLot); } } diff --git a/trade/trade-core/src/main/java/org/marketcetera/trade/pnl/SimplePositionFactory.java b/trade/trade-core/src/main/java/org/marketcetera/trade/pnl/SimplePositionFactory.java index 3b7e8512ef..ad2862dda7 100644 --- a/trade/trade-core/src/main/java/org/marketcetera/trade/pnl/SimplePositionFactory.java +++ b/trade/trade-core/src/main/java/org/marketcetera/trade/pnl/SimplePositionFactory.java @@ -3,6 +3,8 @@ // package org.marketcetera.trade.pnl; +import org.marketcetera.core.Preserve; + /* $License$ */ /** @@ -12,28 +14,29 @@ * @version $Id$ * @since $Release$ */ +@Preserve public class SimplePositionFactory - implements org.marketcetera.trade.pnl.PositionFactory + implements PositionFactory { /** - * Create a new org.marketcetera.trade.pnl.SimplePosition instance. + * Create a new SimplePosition instance. * - * @return a org.marketcetera.trade.pnl.SimplePosition value + * @return a SimplePosition value */ @Override - public org.marketcetera.trade.pnl.SimplePosition create() + public SimplePosition create() { - return new org.marketcetera.trade.pnl.SimplePosition(); + return new SimplePosition(); } /** - * Create a new org.marketcetera.trade.pnl.SimplePosition instance from the given object. + * Create a new SimplePosition instance from the given object. * - * @param inObject a org.marketcetera.trade.pnl.SimplePosition value - * @return a org.marketcetera.trade.pnl.SimplePosition value + * @param inPosition a SimplePosition value + * @return a SimplePosition value */ @Override - public org.marketcetera.trade.pnl.SimplePosition create(org.marketcetera.trade.pnl.Position inSimplePosition) + public SimplePosition create(Position inPosition) { - return new org.marketcetera.trade.pnl.SimplePosition(inSimplePosition); + return new SimplePosition(inPosition); } } diff --git a/trade/trade-core/src/main/java/org/marketcetera/trade/pnl/SimpleProfitAndLossFactory.java b/trade/trade-core/src/main/java/org/marketcetera/trade/pnl/SimpleProfitAndLossFactory.java index 90bf8f77fc..ec45c7e03d 100644 --- a/trade/trade-core/src/main/java/org/marketcetera/trade/pnl/SimpleProfitAndLossFactory.java +++ b/trade/trade-core/src/main/java/org/marketcetera/trade/pnl/SimpleProfitAndLossFactory.java @@ -3,6 +3,8 @@ // package org.marketcetera.trade.pnl; +import org.marketcetera.core.Preserve; + /* $License$ */ /** @@ -12,28 +14,29 @@ * @version $Id$ * @since $Release$ */ +@Preserve public class SimpleProfitAndLossFactory - implements org.marketcetera.trade.pnl.ProfitAndLossFactory + implements ProfitAndLossFactory { /** - * Create a new org.marketcetera.trade.pnl.SimpleProfitAndLoss instance. + * Create a new SimpleProfitAndLoss instance. * - * @return a org.marketcetera.trade.pnl.SimpleProfitAndLoss value + * @return a SimpleProfitAndLoss value */ @Override - public org.marketcetera.trade.pnl.SimpleProfitAndLoss create() + public SimpleProfitAndLoss create() { - return new org.marketcetera.trade.pnl.SimpleProfitAndLoss(); + return new SimpleProfitAndLoss(); } /** - * Create a new org.marketcetera.trade.pnl.SimpleProfitAndLoss instance from the given object. + * Create a new SimpleProfitAndLoss instance from the given object. * - * @param inObject a org.marketcetera.trade.pnl.SimpleProfitAndLoss value - * @return a org.marketcetera.trade.pnl.SimpleProfitAndLoss value + * @param inProfitAndLoss a ProfitAndLoss value + * @return a SimpleProfitAndLoss value */ @Override - public org.marketcetera.trade.pnl.SimpleProfitAndLoss create(org.marketcetera.trade.pnl.ProfitAndLoss inSimpleProfitAndLoss) + public SimpleProfitAndLoss create(ProfitAndLoss inProfitAndLoss) { - return new org.marketcetera.trade.pnl.SimpleProfitAndLoss(inSimpleProfitAndLoss); + return new SimpleProfitAndLoss(inProfitAndLoss); } } diff --git a/trade/trade-core/src/main/java/org/marketcetera/trade/pnl/SimpleTradeFactory.java b/trade/trade-core/src/main/java/org/marketcetera/trade/pnl/SimpleTradeFactory.java index 2834675aa5..88575177fc 100644 --- a/trade/trade-core/src/main/java/org/marketcetera/trade/pnl/SimpleTradeFactory.java +++ b/trade/trade-core/src/main/java/org/marketcetera/trade/pnl/SimpleTradeFactory.java @@ -3,6 +3,8 @@ // package org.marketcetera.trade.pnl; +import org.marketcetera.core.Preserve; + /* $License$ */ /** @@ -12,28 +14,29 @@ * @version $Id$ * @since $Release$ */ +@Preserve public class SimpleTradeFactory - implements org.marketcetera.trade.pnl.TradeFactory + implements TradeFactory { /** - * Create a new org.marketcetera.trade.pnl.SimpleTrade instance. + * Create a new SimpleTrade instance. * - * @return a org.marketcetera.trade.pnl.SimpleTrade value + * @return a SimpleTrade value */ @Override - public org.marketcetera.trade.pnl.SimpleTrade create() + public SimpleTrade create() { - return new org.marketcetera.trade.pnl.SimpleTrade(); + return new SimpleTrade(); } /** - * Create a new org.marketcetera.trade.pnl.SimpleTrade instance from the given object. + * Create a new SimpleTrade instance from the given object. * - * @param inObject a org.marketcetera.trade.pnl.SimpleTrade value - * @return a org.marketcetera.trade.pnl.SimpleTrade value + * @param inTrade a Trade value + * @return a SimpleTrade value */ @Override - public org.marketcetera.trade.pnl.SimpleTrade create(org.marketcetera.trade.pnl.Trade inSimpleTrade) + public SimpleTrade create(Trade inTrade) { - return new org.marketcetera.trade.pnl.SimpleTrade(inSimpleTrade); + return new SimpleTrade(inTrade); } } diff --git a/trade/trade-core/src/main/java/org/marketcetera/trade/pnl/SimpleUserTradeFactory.java b/trade/trade-core/src/main/java/org/marketcetera/trade/pnl/SimpleUserTradeFactory.java index c4867a7912..4fbe9bc95a 100644 --- a/trade/trade-core/src/main/java/org/marketcetera/trade/pnl/SimpleUserTradeFactory.java +++ b/trade/trade-core/src/main/java/org/marketcetera/trade/pnl/SimpleUserTradeFactory.java @@ -3,6 +3,8 @@ // package org.marketcetera.trade.pnl; +import org.marketcetera.core.Preserve; + /* $License$ */ /** @@ -12,28 +14,29 @@ * @version $Id$ * @since $Release$ */ +@Preserve public class SimpleUserTradeFactory - implements org.marketcetera.trade.pnl.UserTradeFactory + implements UserTradeFactory { /** - * Create a new org.marketcetera.trade.pnl.SimpleUserTrade instance. + * Create a new SimpleUserTrade instance. * - * @return a org.marketcetera.trade.pnl.SimpleUserTrade value + * @return a SimpleUserTrade value */ @Override - public org.marketcetera.trade.pnl.SimpleUserTrade create() + public SimpleUserTrade create() { - return new org.marketcetera.trade.pnl.SimpleUserTrade(); + return new SimpleUserTrade(); } /** - * Create a new org.marketcetera.trade.pnl.SimpleUserTrade instance from the given object. + * Create a new SimpleUserTrade instance from the given object. * - * @param inObject a org.marketcetera.trade.pnl.SimpleUserTrade value - * @return a org.marketcetera.trade.pnl.SimpleUserTrade value + * @param inUserTrade a UserTrade value + * @return a SimpleUserTrade value */ @Override - public org.marketcetera.trade.pnl.SimpleUserTrade create(org.marketcetera.trade.pnl.UserTrade inSimpleUserTrade) + public SimpleUserTrade create(UserTrade inUserTrade) { - return new org.marketcetera.trade.pnl.SimpleUserTrade(inSimpleUserTrade); + return new SimpleUserTrade(inUserTrade); } } diff --git a/trade/trade-rpc-client/.gitignore b/trade/trade-rpc-client/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/trade/trade-rpc-client/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/trade/trade-rpc-client/src/main/java/org/marketcetera/trading/rpc/TradeRpcClient.java b/trade/trade-rpc-client/src/main/java/org/marketcetera/trading/rpc/TradeRpcClient.java index 23eba06203..1f994fa2b8 100644 --- a/trade/trade-rpc-client/src/main/java/org/marketcetera/trading/rpc/TradeRpcClient.java +++ b/trade/trade-rpc-client/src/main/java/org/marketcetera/trading/rpc/TradeRpcClient.java @@ -42,7 +42,6 @@ import org.marketcetera.trade.BrokerID; import org.marketcetera.trade.ExecutionReport; import org.marketcetera.trade.ExecutionReportSummary; -import org.marketcetera.trade.FIXOrder; import org.marketcetera.trade.Instrument; import org.marketcetera.trade.MutableExecutionReportSummary; import org.marketcetera.trade.MutableExecutionReportSummaryFactory; @@ -50,23 +49,20 @@ import org.marketcetera.trade.MutableOrderSummaryFactory; import org.marketcetera.trade.MutableReport; import org.marketcetera.trade.MutableReportFactory; -import org.marketcetera.trade.NewOrReplaceOrder; import org.marketcetera.trade.Option; import org.marketcetera.trade.Order; -import org.marketcetera.trade.OrderBase; -import org.marketcetera.trade.OrderCancel; import org.marketcetera.trade.OrderID; -import org.marketcetera.trade.OrderReplace; -import org.marketcetera.trade.OrderSingle; import org.marketcetera.trade.OrderSummary; -import org.marketcetera.trade.RelatedOrder; import org.marketcetera.trade.Report; import org.marketcetera.trade.ReportID; +import org.marketcetera.trade.Suggestion; +import org.marketcetera.trade.SuggestionListener; import org.marketcetera.trade.TradeMessage; import org.marketcetera.trade.TradeMessageListener; import org.marketcetera.trade.client.SendOrderResponse; import org.marketcetera.trade.client.TradeClient; import org.marketcetera.trade.rpc.TradeRpc; +import org.marketcetera.trade.rpc.TradeRpc.SuggestionListenerResponse; import org.marketcetera.trade.rpc.TradeRpc.TradeMessageListenerResponse; import org.marketcetera.trade.rpc.TradeRpcServiceGrpc; import org.marketcetera.trade.rpc.TradeRpcServiceGrpc.TradeRpcServiceBlockingStub; @@ -172,6 +168,80 @@ public Void call() } }); } + /* (non-Javadoc) + * @see org.marketcetera.trade.client.TradeClient#addSuggestionListener(org.marketcetera.trade.SuggestionListener) + */ + @Override + public void addSuggestionListener(SuggestionListener inSuggestionListener) + { + // check to see if this listener is already registered + if(listenerProxies.asMap().containsKey(inSuggestionListener)) { + return; + } + // make sure that this listener wasn't just whisked out from under us + final AbstractClientListenerProxy listener = listenerProxies.getUnchecked(inSuggestionListener); + if(listener == null) { + return; + } + executeCall(new Callable() { + @Override + public Void call() + throws Exception + { + SLF4JLoggerProxy.trace(TradeRpcClient.this, + "{} adding suggestion listener", + getSessionId()); + TradeRpc.AddSuggestionListenerRequest.Builder requestBuilder = TradeRpc.AddSuggestionListenerRequest.newBuilder(); + requestBuilder.setSessionId(getSessionId().getValue()); + requestBuilder.setListenerId(listener.getId()); + TradeRpc.AddSuggestionListenerRequest addSuggestionListenerRequest = requestBuilder.build(); + SLF4JLoggerProxy.trace(TradeRpcClient.this, + "{} sending {}", + getSessionId(), + addSuggestionListenerRequest); + getAsyncStub().addSuggestionListener(addSuggestionListenerRequest, + (SuggestionListenerProxy)listener); + return null; + } + }); + } + /* (non-Javadoc) + * @see org.marketcetera.trade.client.TradeClient#removeSuggestionListener(org.marketcetera.trade.SuggestionListener) + */ + @Override + public void removeSuggestionListener(SuggestionListener inSuggestionListener) + { + final AbstractClientListenerProxy proxy = listenerProxies.getIfPresent(inSuggestionListener); + listenerProxies.invalidate(inSuggestionListener); + if(proxy == null) { + return; + } + listenerProxiesById.invalidate(proxy.getId()); + executeCall(new Callable() { + @Override + public Void call() + throws Exception + { + SLF4JLoggerProxy.trace(TradeRpcClient.this, + "{} removing report listener", + getSessionId()); + TradeRpc.RemoveSuggestionListenerRequest.Builder requestBuilder = TradeRpc.RemoveSuggestionListenerRequest.newBuilder(); + requestBuilder.setSessionId(getSessionId().getValue()); + requestBuilder.setListenerId(proxy.getId()); + TradeRpc.RemoveSuggestionListenerRequest removeSuggestionListenerRequest = requestBuilder.build(); + SLF4JLoggerProxy.trace(TradeRpcClient.this, + "{} sending {}", + getSessionId(), + removeSuggestionListenerRequest); + TradeRpc.RemoveSuggestionListenerResponse response = getBlockingStub().removeSuggestionListener(removeSuggestionListenerRequest); + SLF4JLoggerProxy.trace(TradeRpcClient.this, + "{} received {}", + getSessionId(), + response); + return null; + } + }); + } /* (non-Javadoc) * @see org.marketcetera.trade.client.TradingClient#findRootOrderIdFor(org.marketcetera.trade.OrderID) */ @@ -574,6 +644,38 @@ public ExecutionReport call() } }); } + /* (non-Javadoc) + * @see org.marketcetera.trade.client.TradeClient#sendOrderSuggestion(org.marketcetera.trade.Suggestion) + */ + @Override + public void sendOrderSuggestion(Suggestion inSuggestion) + { + executeCall(new Callable(){ + @Override + public Void call() + throws Exception + { + SLF4JLoggerProxy.trace(TradeRpcClient.this, + "{} sending {}", + getSessionId(), + inSuggestion); + TradeRpc.SendSuggestionRequest.Builder requestBuilder = TradeRpc.SendSuggestionRequest.newBuilder(); + requestBuilder.setSessionId(getSessionId().getValue()); + TradeRpcUtil.getSuggestion(inSuggestion).ifPresent(rpcSuggestion -> requestBuilder.addSuggestion(rpcSuggestion)); + TradeRpc.SendSuggestionRequest sendSuggestionRequest = requestBuilder.build(); + SLF4JLoggerProxy.trace(TradeRpcClient.this, + "{} sending {}", + getSessionId(), + sendSuggestionRequest); + TradeRpc.SendSuggestionResponse response = getBlockingStub().sendSuggestion(sendSuggestionRequest); + SLF4JLoggerProxy.trace(TradeRpcClient.this, + "{} returning {}", + getSessionId(), + response); + return null; + } + }); + } /* (non-Javadoc) * @see org.marketcetera.trade.client.TradingClient#sendOrders(java.util.List) */ @@ -590,109 +692,10 @@ public List call() getSessionId(), inOrders.size()); TradeRpc.SendOrderRequest.Builder requestBuilder = TradeRpc.SendOrderRequest.newBuilder(); - TradeTypesRpc.Order.Builder orderBuilder = TradeTypesRpc.Order.newBuilder(); - TradeTypesRpc.OrderBase.Builder orderBaseBuilder = null; - TradeTypesRpc.FIXOrder.Builder fixOrderBuilder = null; - BaseRpc.Map.Builder mapBuilder = null; - BaseRpc.KeyValuePair.Builder keyValuePairBuilder = null; requestBuilder.setSessionId(getSessionId().getValue()); for(Order order : inOrders) { try { - if(order instanceof FIXOrder) { - FIXOrder fixOrder = (FIXOrder)order; - if(fixOrderBuilder == null) { - fixOrderBuilder = TradeTypesRpc.FIXOrder.newBuilder(); - } else { - fixOrderBuilder.clear(); - } - if(mapBuilder == null) { - mapBuilder = BaseRpc.Map.newBuilder(); - } else { - mapBuilder.clear(); - } - for(Map.Entry entry : fixOrder.getFields().entrySet()) { - if(keyValuePairBuilder == null) { - keyValuePairBuilder = BaseRpc.KeyValuePair.newBuilder(); - } else { - keyValuePairBuilder.clear(); - } - keyValuePairBuilder.setKey(String.valueOf(entry.getKey())); - keyValuePairBuilder.setValue(entry.getValue()); - mapBuilder.addKeyValuePairs(keyValuePairBuilder.build()); - } - orderBuilder.setMatpOrderType(TradeTypesRpc.MatpOrderType.FIXOrderType); - TradeRpcUtil.setBrokerId(fixOrder, - fixOrderBuilder); - // TODO -// fixOrderBuilder.setMessage(mapBuilder.build()); - orderBuilder.setFixOrder(fixOrderBuilder.build()); - } else if(order instanceof OrderBase) { - if(orderBaseBuilder == null) { - orderBaseBuilder = TradeTypesRpc.OrderBase.newBuilder(); - } else { - orderBaseBuilder.clear(); - } - // either an OrderSingle, OrderReplace, or OrderCancel - // the types overlap some, first, set all the common fields on OrderBase - OrderBase orderBase = (OrderBase)order; - TradeRpcUtil.setAccount(orderBase, - orderBaseBuilder); - TradeRpcUtil.setBrokerId(orderBase, - orderBaseBuilder); - TradeRpcUtil.setRpcCustomFields(orderBase, - orderBaseBuilder); - TradeRpcUtil.setInstrument(orderBase, - orderBaseBuilder); - TradeRpcUtil.setOrderId(orderBase, - orderBaseBuilder); - TradeRpcUtil.setQuantity(orderBase, - orderBaseBuilder); - TradeRpcUtil.setSide(orderBase, - orderBaseBuilder); - TradeRpcUtil.setText(orderBase, - orderBaseBuilder); - // now, check for various special order types - if(orderBase instanceof NewOrReplaceOrder) { - NewOrReplaceOrder newOrReplaceOrder = (NewOrReplaceOrder)orderBase; - TradeRpcUtil.setDisplayQuantity(newOrReplaceOrder, - orderBaseBuilder); - TradeRpcUtil.setExecutionDestination(newOrReplaceOrder, - orderBaseBuilder); - TradeRpcUtil.setOrderCapacity(newOrReplaceOrder, - orderBaseBuilder); - TradeRpcUtil.setOrderType(newOrReplaceOrder, - orderBaseBuilder); - TradeRpcUtil.setPositionEffect(newOrReplaceOrder, - orderBaseBuilder); - TradeRpcUtil.setPrice(newOrReplaceOrder, - orderBaseBuilder); - TradeRpcUtil.setTimeInForce(newOrReplaceOrder, - orderBaseBuilder); - } - if(order instanceof RelatedOrder) { - RelatedOrder relatedOrder = (RelatedOrder)order; - TradeRpcUtil.setOriginalOrderId(relatedOrder, - orderBaseBuilder); - } - TradeTypesRpc.OrderBase rpcOrderBase = orderBaseBuilder.build(); - orderBuilder.setOrderBase(rpcOrderBase); - if(order instanceof OrderCancel) { - orderBuilder.setMatpOrderType(TradeTypesRpc.MatpOrderType.OrderCancelType); - } else if(order instanceof OrderSingle) { - orderBuilder.setMatpOrderType(TradeTypesRpc.MatpOrderType.OrderSingleType); - } else if(order instanceof OrderReplace) { - orderBuilder.setMatpOrderType(TradeTypesRpc.MatpOrderType.OrderReplaceType); - } else { - throw new UnsupportedOperationException("Unsupported order type: " + order.getClass().getSimpleName()); - } - } else { - throw new UnsupportedOperationException("Unsupported order type: " + order.getClass().getSimpleName()); - } - requestBuilder.addOrder(orderBuilder.build()); - orderBuilder.clear(); - if(orderBaseBuilder != null) { - orderBaseBuilder.clear(); - } + TradeRpcUtil.getOrder(order).ifPresent(rpcOrder -> requestBuilder.addOrder(rpcOrder)); } catch (Exception e) { PlatformServices.handleException(TradeRpcClient.this, "Unable to send " + order, @@ -1053,6 +1056,8 @@ private static AbstractClientListenerProxy getListenerFor(Object inListen { if(inListener instanceof TradeMessageListener) { return new TradeMessageListenerProxy((TradeMessageListener)inListener); + } else if(inListener instanceof SuggestionListener) { + return new SuggestionListenerProxy((SuggestionListener)inListener); } else { throw new UnsupportedOperationException(); } @@ -1094,6 +1099,43 @@ protected TradeMessageListenerProxy(TradeMessageListener inTradeMessageListener) super(inTradeMessageListener); } } + /** + * Provides an interface between suggestion stream listeners and their handlers. + * + * @author Colin DuPlantis + * @version $Id$ + * @since $Release$ + */ + private static class SuggestionListenerProxy + extends BaseRpcUtil.AbstractClientListenerProxy + { + /* (non-Javadoc) + * @see org.marketcetera.trade.rpc.TradeRpcClient.AbstractListenerProxy#translateMessage(java.lang.Object) + */ + @Override + protected Suggestion translateMessage(SuggestionListenerResponse inResponse) + { + return TradeRpcUtil.getSuggestion(inResponse); + } + /* (non-Javadoc) + * @see org.marketcetera.trade.rpc.TradeRpcClient.AbstractListenerProxy#sendMessage(java.lang.Object, java.lang.Object) + */ + @Override + protected void sendMessage(SuggestionListener inMessageListener, + Suggestion inMessage) + { + inMessageListener.receiveSuggestion(inMessage); + } + /** + * Create a new SuggestionListenerProxy instance. + * + * @param inSuggestionListener a SuggestionListener value + */ + protected SuggestionListenerProxy(SuggestionListener inSuggestionListener) + { + super(inSuggestionListener); + } + } /** * creates {@link AverageFillPrice} objects */ diff --git a/trade/trade-rpc-core/.gitignore b/trade/trade-rpc-core/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/trade/trade-rpc-core/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/trade/trade-rpc-core/src/main/java/org/marketcetera/trade/pnl/TradePnlRpcUtil.java b/trade/trade-rpc-core/src/main/java/org/marketcetera/trade/pnl/TradePnlRpcUtil.java index a37ae0e2f6..c2739eb004 100644 --- a/trade/trade-rpc-core/src/main/java/org/marketcetera/trade/pnl/TradePnlRpcUtil.java +++ b/trade/trade-rpc-core/src/main/java/org/marketcetera/trade/pnl/TradePnlRpcUtil.java @@ -3,6 +3,14 @@ // package org.marketcetera.trade.pnl; +import java.util.Optional; + +import org.marketcetera.admin.UserFactory; +import org.marketcetera.admin.rpc.AdminRpcUtil; +import org.marketcetera.core.Preserve; +import org.marketcetera.rpc.base.BaseRpcUtil; +import org.marketcetera.trading.rpc.TradeRpcUtil; + /* $License$ */ /** @@ -12,266 +20,283 @@ * @version $Id$ * @since $Release$ */ +@Preserve public abstract class TradePnlRpcUtil { /** * Get the RPC object from the given value. * - * @param inPosition a org.marketcetera.trade.pnl.Position value - * @return a java.util.Optional value + * @param inPosition a Position value + * @return a Optional<TradePnlTypesRpc.PnlPosition> value */ - public static java.util.Optional getRpcPnlPosition(org.marketcetera.trade.pnl.Position inPosition) + public static Optional getRpcPnlPosition(Position inPosition) { if(inPosition == null) { - return java.util.Optional.empty(); + return Optional.empty(); } TradePnlTypesRpc.PnlPosition.Builder builder = TradePnlTypesRpc.PnlPosition.newBuilder(); - org.marketcetera.trading.rpc.TradeRpcUtil.getRpcInstrument(inPosition.getInstrument()).ifPresent(value->builder.setInstrument(value)); - org.marketcetera.admin.rpc.AdminRpcUtil.getRpcUser(inPosition.getUser()).ifPresent(value->builder.setUser(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getRpcQty(inPosition.getPosition()).ifPresent(value->builder.setPosition(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getTimestampValue(inPosition.getEffectiveDate()).ifPresent(value->builder.setEffectiveDate(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getRpcQty(inPosition.getWeightedAverageCost()).ifPresent(value->builder.setWeightedAverageCost(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getRpcQty(inPosition.getRealizedGain()).ifPresent(value->builder.setRealizedGain(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getRpcQty(inPosition.getUnrealizedGain()).ifPresent(value->builder.setUnrealizedGain(value)); - return java.util.Optional.of(builder.build()); + TradeRpcUtil.getRpcInstrument(inPosition.getInstrument()).ifPresent(value->builder.setInstrument(value)); + AdminRpcUtil.getRpcUser(inPosition.getUser()).ifPresent(value->builder.setUser(value)); + BaseRpcUtil.getRpcQty(inPosition.getPosition()).ifPresent(value->builder.setPosition(value)); + BaseRpcUtil.getTimestampValue(inPosition.getEffectiveDate()).ifPresent(value->builder.setEffectiveDate(value)); + BaseRpcUtil.getRpcQty(inPosition.getWeightedAverageCost()).ifPresent(value->builder.setWeightedAverageCost(value)); + BaseRpcUtil.getRpcQty(inPosition.getRealizedGain()).ifPresent(value->builder.setRealizedGain(value)); + BaseRpcUtil.getRpcQty(inPosition.getUnrealizedGain()).ifPresent(value->builder.setUnrealizedGain(value)); + return Optional.of(builder.build()); } /** * Get the RPC object from the given value. * - * @param inCurrentPosition a org.marketcetera.trade.pnl.CurrentPosition value - * @return a java.util.Optional value + * @param inCurrentPosition a CurrentPosition value + * @return an Optional<TradePnlTypesRpc.CurrentPnlPosition< value */ - public static java.util.Optional getRpcCurrentPnlPosition(org.marketcetera.trade.pnl.CurrentPosition inCurrentPosition) + public static Optional getRpcCurrentPnlPosition(CurrentPosition inCurrentPosition) { if(inCurrentPosition == null) { - return java.util.Optional.empty(); + return Optional.empty(); } TradePnlTypesRpc.CurrentPnlPosition.Builder builder = TradePnlTypesRpc.CurrentPnlPosition.newBuilder(); - org.marketcetera.trading.rpc.TradeRpcUtil.getRpcInstrument(inCurrentPosition.getInstrument()).ifPresent(value->builder.setInstrument(value)); - org.marketcetera.admin.rpc.AdminRpcUtil.getRpcUser(inCurrentPosition.getUser()).ifPresent(value->builder.setUser(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getRpcQty(inCurrentPosition.getPosition()).ifPresent(value->builder.setPosition(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getRpcQty(inCurrentPosition.getWeightedAverageCost()).ifPresent(value->builder.setWeightedAverageCost(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getRpcQty(inCurrentPosition.getRealizedGain()).ifPresent(value->builder.setRealizedGain(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getRpcQty(inCurrentPosition.getUnrealizedGain()).ifPresent(value->builder.setUnrealizedGain(value)); - return java.util.Optional.of(builder.build()); + TradeRpcUtil.getRpcInstrument(inCurrentPosition.getInstrument()).ifPresent(value->builder.setInstrument(value)); + AdminRpcUtil.getRpcUser(inCurrentPosition.getUser()).ifPresent(value->builder.setUser(value)); + BaseRpcUtil.getRpcQty(inCurrentPosition.getPosition()).ifPresent(value->builder.setPosition(value)); + BaseRpcUtil.getRpcQty(inCurrentPosition.getWeightedAverageCost()).ifPresent(value->builder.setWeightedAverageCost(value)); + BaseRpcUtil.getRpcQty(inCurrentPosition.getRealizedGain()).ifPresent(value->builder.setRealizedGain(value)); + BaseRpcUtil.getRpcQty(inCurrentPosition.getUnrealizedGain()).ifPresent(value->builder.setUnrealizedGain(value)); + return Optional.of(builder.build()); } /** * Get the RPC object from the given value. * - * @param inProfitAndLoss a org.marketcetera.trade.pnl.ProfitAndLoss value - * @return a java.util.Optional value + * @param inProfitAndLoss a ProfitAndLoss value + * @return an Optional<TradePnlTypesRpc.ProfitAndLoss> value */ - public static java.util.Optional getRpcProfitAndLoss(org.marketcetera.trade.pnl.ProfitAndLoss inProfitAndLoss) + public static Optional getRpcProfitAndLoss(ProfitAndLoss inProfitAndLoss) { if(inProfitAndLoss == null) { - return java.util.Optional.empty(); + return Optional.empty(); } TradePnlTypesRpc.ProfitAndLoss.Builder builder = TradePnlTypesRpc.ProfitAndLoss.newBuilder(); - org.marketcetera.trading.rpc.TradeRpcUtil.getRpcInstrument(inProfitAndLoss.getInstrument()).ifPresent(value->builder.setInstrument(value)); - org.marketcetera.admin.rpc.AdminRpcUtil.getRpcUser(inProfitAndLoss.getUser()).ifPresent(value->builder.setUser(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getRpcQty(inProfitAndLoss.getRealizedGain()).ifPresent(value->builder.setRealizedGain(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getRpcQty(inProfitAndLoss.getUnrealizedGain()).ifPresent(value->builder.setUnrealizedGain(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getRpcQty(inProfitAndLoss.getBasisPrice()).ifPresent(value->builder.setBasisPrice(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getRpcQty(inProfitAndLoss.getPosition()).ifPresent(value->builder.setPosition(value)); - return java.util.Optional.of(builder.build()); + TradeRpcUtil.getRpcInstrument(inProfitAndLoss.getInstrument()).ifPresent(value->builder.setInstrument(value)); + AdminRpcUtil.getRpcUser(inProfitAndLoss.getUser()).ifPresent(value->builder.setUser(value)); + BaseRpcUtil.getRpcQty(inProfitAndLoss.getRealizedGain()).ifPresent(value->builder.setRealizedGain(value)); + BaseRpcUtil.getRpcQty(inProfitAndLoss.getUnrealizedGain()).ifPresent(value->builder.setUnrealizedGain(value)); + BaseRpcUtil.getRpcQty(inProfitAndLoss.getBasisPrice()).ifPresent(value->builder.setBasisPrice(value)); + BaseRpcUtil.getRpcQty(inProfitAndLoss.getPosition()).ifPresent(value->builder.setPosition(value)); + return Optional.of(builder.build()); } /** * Get the RPC object from the given value. * - * @param inLot a org.marketcetera.trade.pnl.Lot value - * @return a java.util.Optional value + * @param inLot a Lot value + * @return an Optional<TradePnlTypesRpc.Lot> value */ - public static java.util.Optional getRpcLot(org.marketcetera.trade.pnl.Lot inLot) + public static Optional getRpcLot(Lot inLot) { if(inLot == null) { - return java.util.Optional.empty(); + return Optional.empty(); } TradePnlTypesRpc.Lot.Builder builder = TradePnlTypesRpc.Lot.newBuilder(); - org.marketcetera.admin.rpc.AdminRpcUtil.getRpcUser(inLot.getUser()).ifPresent(value->builder.setUser(value)); - org.marketcetera.trade.pnl.TradePnlRpcUtil.getRpcTrade(inLot.getTrade()).ifPresent(value->builder.setTrade(value)); - org.marketcetera.trade.pnl.TradePnlRpcUtil.getRpcPnlPosition(inLot.getPosition()).ifPresent(value->builder.setPosition(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getRpcQty(inLot.getQuantity()).ifPresent(value->builder.setQuantity(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getRpcQty(inLot.getAllocatedQuantity()).ifPresent(value->builder.setAllocatedQuantity(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getTimestampValue(inLot.getEffectiveDate()).ifPresent(value->builder.setEffectiveDate(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getRpcQty(inLot.getBasisPrice()).ifPresent(value->builder.setBasisPrice(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getRpcQty(inLot.getGain()).ifPresent(value->builder.setGain(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getRpcQty(inLot.getTradePrice()).ifPresent(value->builder.setTradePrice(value)); - return java.util.Optional.of(builder.build()); + AdminRpcUtil.getRpcUser(inLot.getUser()).ifPresent(value->builder.setUser(value)); + TradePnlRpcUtil.getRpcTrade(inLot.getTrade()).ifPresent(value->builder.setTrade(value)); + TradePnlRpcUtil.getRpcPnlPosition(inLot.getPosition()).ifPresent(value->builder.setPosition(value)); + BaseRpcUtil.getRpcQty(inLot.getQuantity()).ifPresent(value->builder.setQuantity(value)); + BaseRpcUtil.getRpcQty(inLot.getAllocatedQuantity()).ifPresent(value->builder.setAllocatedQuantity(value)); + BaseRpcUtil.getTimestampValue(inLot.getEffectiveDate()).ifPresent(value->builder.setEffectiveDate(value)); + BaseRpcUtil.getRpcQty(inLot.getBasisPrice()).ifPresent(value->builder.setBasisPrice(value)); + BaseRpcUtil.getRpcQty(inLot.getGain()).ifPresent(value->builder.setGain(value)); + BaseRpcUtil.getRpcQty(inLot.getTradePrice()).ifPresent(value->builder.setTradePrice(value)); + return Optional.of(builder.build()); } /** * Get the RPC object from the given value. * - * @param inTrade a org.marketcetera.trade.pnl.Trade value - * @return a java.util.Optional value + * @param inTrade a Trade value + * @return an Optional<TradePnlTypesRpc.Trade> value */ - public static java.util.Optional getRpcTrade(org.marketcetera.trade.pnl.Trade inTrade) + public static Optional getRpcTrade(Trade inTrade) { if(inTrade == null) { - return java.util.Optional.empty(); + return Optional.empty(); } TradePnlTypesRpc.Trade.Builder builder = TradePnlTypesRpc.Trade.newBuilder(); - org.marketcetera.trading.rpc.TradeRpcUtil.getRpcInstrument(inTrade.getInstrument()).ifPresent(value->builder.setInstrument(value)); - org.marketcetera.trading.rpc.TradeRpcUtil.getRpcOrderId(inTrade.getExecutionId()).ifPresent(value->builder.setExecutionId(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getRpcQty(inTrade.getPrice()).ifPresent(value->builder.setPrice(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getRpcQty(inTrade.getQuantity()).ifPresent(value->builder.setQuantity(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getTimestampValue(inTrade.getTransactionTime()).ifPresent(value->builder.setTransactionTime(value)); - return java.util.Optional.of(builder.build()); + TradeRpcUtil.getRpcInstrument(inTrade.getInstrument()).ifPresent(value->builder.setInstrument(value)); + TradeRpcUtil.getRpcOrderId(inTrade.getExecutionId()).ifPresent(value->builder.setExecutionId(value)); + BaseRpcUtil.getRpcQty(inTrade.getPrice()).ifPresent(value->builder.setPrice(value)); + BaseRpcUtil.getRpcQty(inTrade.getQuantity()).ifPresent(value->builder.setQuantity(value)); + BaseRpcUtil.getTimestampValue(inTrade.getTransactionTime()).ifPresent(value->builder.setTransactionTime(value)); + return Optional.of(builder.build()); } /** * Get the RPC object from the given value. * - * @param inUserTrade a org.marketcetera.trade.pnl.UserTrade value - * @return a java.util.Optional value + * @param inUserTrade a UserTrade value + * @return an Optional<TradePnlTypesRpc.UserTrade> value */ - public static java.util.Optional getRpcUserTrade(org.marketcetera.trade.pnl.UserTrade inUserTrade) + public static Optional getRpcUserTrade(UserTrade inUserTrade) { if(inUserTrade == null) { - return java.util.Optional.empty(); + return Optional.empty(); } TradePnlTypesRpc.UserTrade.Builder builder = TradePnlTypesRpc.UserTrade.newBuilder(); - org.marketcetera.trade.pnl.TradePnlRpcUtil.getRpcTrade(inUserTrade.getTrade()).ifPresent(value->builder.setTrade(value)); - org.marketcetera.admin.rpc.AdminRpcUtil.getRpcUser(inUserTrade.getUser()).ifPresent(value->builder.setUser(value)); - builder.setSide(org.marketcetera.trading.rpc.TradeRpcUtil.getRpcSide(inUserTrade.getSide())); - org.marketcetera.trade.pnl.TradePnlRpcUtil.getRpcProfitAndLoss(inUserTrade.getProfitAndLoss()).ifPresent(value->builder.setProfitAndLoss(value)); - org.marketcetera.trading.rpc.TradeRpcUtil.getRpcOrderId(inUserTrade.getOrderId()).ifPresent(value->builder.setOrderId(value)); - return java.util.Optional.of(builder.build()); + TradePnlRpcUtil.getRpcTrade(inUserTrade.getTrade()).ifPresent(value->builder.setTrade(value)); + AdminRpcUtil.getRpcUser(inUserTrade.getUser()).ifPresent(value->builder.setUser(value)); + builder.setSide(TradeRpcUtil.getRpcSide(inUserTrade.getSide())); + TradePnlRpcUtil.getRpcProfitAndLoss(inUserTrade.getProfitAndLoss()).ifPresent(value->builder.setProfitAndLoss(value)); + TradeRpcUtil.getRpcOrderId(inUserTrade.getOrderId()).ifPresent(value->builder.setOrderId(value)); + return Optional.of(builder.build()); } /** * Get the object from the given RPC value. * - * @param inPosition a org.marketcetera.trade.pnl.TradePnlTypesRpc.PnlPosition value - * @param inPositionFactory a org.marketcetera.trade.pnl.PositionFactory value - * @param inUserFactory a org.marketcetera.admin.UserFactory value - * @return a org.marketcetera.trade.pnl.Position value + * @param inPosition a TradePnlTypesRpc.PnlPosition value + * @param inPositionFactory a PositionFactory value + * @param inUserFactory a UserFactory value + * @return an Optional<Position< value */ - public static java.util.Optional getPnlPosition(org.marketcetera.trade.pnl.TradePnlTypesRpc.PnlPosition inPosition,org.marketcetera.trade.pnl.PositionFactory inPositionFactory,org.marketcetera.admin.UserFactory inUserFactory) + public static Optional getPnlPosition(TradePnlTypesRpc.PnlPosition inPosition, + PositionFactory inPositionFactory, + UserFactory inUserFactory) { if(inPosition == null) { - return java.util.Optional.empty(); + return Optional.empty(); } - org.marketcetera.trade.pnl.Position position = inPositionFactory.create(); - org.marketcetera.trading.rpc.TradeRpcUtil.getInstrument(inPosition.getInstrument()).ifPresent(value->position.setInstrument(value)); - org.marketcetera.admin.rpc.AdminRpcUtil.getUser(inPosition.getUser(),inUserFactory).ifPresent(value->position.setUser(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getScaledQuantity(inPosition.getPosition()).ifPresent(value->position.setPosition(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getDateValue(inPosition.getEffectiveDate()).ifPresent(value->position.setEffectiveDate(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getScaledQuantity(inPosition.getWeightedAverageCost()).ifPresent(value->position.setWeightedAverageCost(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getScaledQuantity(inPosition.getRealizedGain()).ifPresent(value->position.setRealizedGain(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getScaledQuantity(inPosition.getUnrealizedGain()).ifPresent(value->position.setUnrealizedGain(value)); - return java.util.Optional.of(position); + Position position = inPositionFactory.create(); + TradeRpcUtil.getInstrument(inPosition.getInstrument()).ifPresent(value->position.setInstrument(value)); + AdminRpcUtil.getUser(inPosition.getUser(),inUserFactory).ifPresent(value->position.setUser(value)); + BaseRpcUtil.getScaledQuantity(inPosition.getPosition()).ifPresent(value->position.setPosition(value)); + BaseRpcUtil.getDateValue(inPosition.getEffectiveDate()).ifPresent(value->position.setEffectiveDate(value)); + BaseRpcUtil.getScaledQuantity(inPosition.getWeightedAverageCost()).ifPresent(value->position.setWeightedAverageCost(value)); + BaseRpcUtil.getScaledQuantity(inPosition.getRealizedGain()).ifPresent(value->position.setRealizedGain(value)); + BaseRpcUtil.getScaledQuantity(inPosition.getUnrealizedGain()).ifPresent(value->position.setUnrealizedGain(value)); + return Optional.of(position); } /** * Get the object from the given RPC value. * - * @param inCurrentPosition a org.marketcetera.trade.pnl.TradePnlTypesRpc.CurrentPnlPosition value - * @param inCurrentPositionFactory a org.marketcetera.trade.pnl.CurrentPositionFactory value - * @param inUserFactory a org.marketcetera.admin.UserFactory value - * @return a org.marketcetera.trade.pnl.CurrentPosition value + * @param inCurrentPosition a TradePnlTypesRpc.CurrentPnlPosition value + * @param inCurrentPositionFactory a CurrentPositionFactory value + * @param inUserFactory a UserFactory value + * @return an Optional<CurrentPosition> value */ - public static java.util.Optional getCurrentPnlPosition(org.marketcetera.trade.pnl.TradePnlTypesRpc.CurrentPnlPosition inCurrentPosition,org.marketcetera.trade.pnl.CurrentPositionFactory inCurrentPositionFactory,org.marketcetera.admin.UserFactory inUserFactory) + public static Optional getCurrentPnlPosition(TradePnlTypesRpc.CurrentPnlPosition inCurrentPosition, + CurrentPositionFactory inCurrentPositionFactory, + UserFactory inUserFactory) { if(inCurrentPosition == null) { - return java.util.Optional.empty(); + return Optional.empty(); } - org.marketcetera.trade.pnl.CurrentPosition currentPosition = inCurrentPositionFactory.create(); - org.marketcetera.trading.rpc.TradeRpcUtil.getInstrument(inCurrentPosition.getInstrument()).ifPresent(value->currentPosition.setInstrument(value)); - org.marketcetera.admin.rpc.AdminRpcUtil.getUser(inCurrentPosition.getUser(),inUserFactory).ifPresent(value->currentPosition.setUser(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getScaledQuantity(inCurrentPosition.getPosition()).ifPresent(value->currentPosition.setPosition(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getScaledQuantity(inCurrentPosition.getWeightedAverageCost()).ifPresent(value->currentPosition.setWeightedAverageCost(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getScaledQuantity(inCurrentPosition.getRealizedGain()).ifPresent(value->currentPosition.setRealizedGain(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getScaledQuantity(inCurrentPosition.getUnrealizedGain()).ifPresent(value->currentPosition.setUnrealizedGain(value)); - return java.util.Optional.of(currentPosition); + CurrentPosition currentPosition = inCurrentPositionFactory.create(); + TradeRpcUtil.getInstrument(inCurrentPosition.getInstrument()).ifPresent(value->currentPosition.setInstrument(value)); + AdminRpcUtil.getUser(inCurrentPosition.getUser(),inUserFactory).ifPresent(value->currentPosition.setUser(value)); + BaseRpcUtil.getScaledQuantity(inCurrentPosition.getPosition()).ifPresent(value->currentPosition.setPosition(value)); + BaseRpcUtil.getScaledQuantity(inCurrentPosition.getWeightedAverageCost()).ifPresent(value->currentPosition.setWeightedAverageCost(value)); + BaseRpcUtil.getScaledQuantity(inCurrentPosition.getRealizedGain()).ifPresent(value->currentPosition.setRealizedGain(value)); + BaseRpcUtil.getScaledQuantity(inCurrentPosition.getUnrealizedGain()).ifPresent(value->currentPosition.setUnrealizedGain(value)); + return Optional.of(currentPosition); } /** * Get the object from the given RPC value. * - * @param inProfitAndLoss a org.marketcetera.trade.pnl.TradePnlTypesRpc.ProfitAndLoss value - * @param inProfitAndLossFactory a org.marketcetera.trade.pnl.ProfitAndLossFactory value - * @param inUserFactory a org.marketcetera.admin.UserFactory value - * @return a org.marketcetera.trade.pnl.ProfitAndLoss value + * @param inProfitAndLoss a TradePnlTypesRpc.ProfitAndLoss value + * @param inProfitAndLossFactory a ProfitAndLossFactory value + * @param inUserFactory a UserFactory value + * @return an Optional<ProfitAndLoss> value */ - public static java.util.Optional getProfitAndLoss(org.marketcetera.trade.pnl.TradePnlTypesRpc.ProfitAndLoss inProfitAndLoss,org.marketcetera.trade.pnl.ProfitAndLossFactory inProfitAndLossFactory,org.marketcetera.admin.UserFactory inUserFactory) + public static Optional getProfitAndLoss(TradePnlTypesRpc.ProfitAndLoss inProfitAndLoss, + ProfitAndLossFactory inProfitAndLossFactory, + UserFactory inUserFactory) { if(inProfitAndLoss == null) { - return java.util.Optional.empty(); + return Optional.empty(); } - org.marketcetera.trade.pnl.ProfitAndLoss profitAndLoss = inProfitAndLossFactory.create(); - org.marketcetera.trading.rpc.TradeRpcUtil.getInstrument(inProfitAndLoss.getInstrument()).ifPresent(value->profitAndLoss.setInstrument(value)); - org.marketcetera.admin.rpc.AdminRpcUtil.getUser(inProfitAndLoss.getUser(),inUserFactory).ifPresent(value->profitAndLoss.setUser(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getScaledQuantity(inProfitAndLoss.getRealizedGain()).ifPresent(value->profitAndLoss.setRealizedGain(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getScaledQuantity(inProfitAndLoss.getUnrealizedGain()).ifPresent(value->profitAndLoss.setUnrealizedGain(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getScaledQuantity(inProfitAndLoss.getBasisPrice()).ifPresent(value->profitAndLoss.setBasisPrice(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getScaledQuantity(inProfitAndLoss.getPosition()).ifPresent(value->profitAndLoss.setPosition(value)); - return java.util.Optional.of(profitAndLoss); + ProfitAndLoss profitAndLoss = inProfitAndLossFactory.create(); + TradeRpcUtil.getInstrument(inProfitAndLoss.getInstrument()).ifPresent(value->profitAndLoss.setInstrument(value)); + AdminRpcUtil.getUser(inProfitAndLoss.getUser(),inUserFactory).ifPresent(value->profitAndLoss.setUser(value)); + BaseRpcUtil.getScaledQuantity(inProfitAndLoss.getRealizedGain()).ifPresent(value->profitAndLoss.setRealizedGain(value)); + BaseRpcUtil.getScaledQuantity(inProfitAndLoss.getUnrealizedGain()).ifPresent(value->profitAndLoss.setUnrealizedGain(value)); + BaseRpcUtil.getScaledQuantity(inProfitAndLoss.getBasisPrice()).ifPresent(value->profitAndLoss.setBasisPrice(value)); + BaseRpcUtil.getScaledQuantity(inProfitAndLoss.getPosition()).ifPresent(value->profitAndLoss.setPosition(value)); + return Optional.of(profitAndLoss); } /** * Get the object from the given RPC value. * - * @param inLot a org.marketcetera.trade.pnl.TradePnlTypesRpc.Lot value - * @param inLotFactory a org.marketcetera.trade.pnl.LotFactory value - * @param inProfitAndLossFactory a org.marketcetera.trade.pnl.ProfitAndLossFactory value - * @param inTradeFactory a org.marketcetera.trade.pnl.TradeFactory value - * @param inUserFactory a org.marketcetera.admin.UserFactory value - * @param inPositionFactory a org.marketcetera.trade.pnl.PositionFactory value - * @return a org.marketcetera.trade.pnl.Lot value + * @param inLot a TradePnlTypesRpc.Lot value + * @param inLotFactory a LotFactory value + * @param inProfitAndLossFactory a ProfitAndLossFactory value + * @param inTradeFactory a TradeFactory value + * @param inUserFactory a UserFactory value + * @param inPositionFactory a PositionFactory value + * @return an Optional<Lot> value */ - public static java.util.Optional getLot(org.marketcetera.trade.pnl.TradePnlTypesRpc.Lot inLot,org.marketcetera.trade.pnl.LotFactory inLotFactory,org.marketcetera.trade.pnl.ProfitAndLossFactory inProfitAndLossFactory,org.marketcetera.trade.pnl.TradeFactory inTradeFactory,org.marketcetera.admin.UserFactory inUserFactory,org.marketcetera.trade.pnl.PositionFactory inPositionFactory) + public static Optional getLot(TradePnlTypesRpc.Lot inLot, + LotFactory inLotFactory, + ProfitAndLossFactory inProfitAndLossFactory, + TradeFactory inTradeFactory, + UserFactory inUserFactory, + PositionFactory inPositionFactory) { if(inLot == null) { - return java.util.Optional.empty(); + return Optional.empty(); } - org.marketcetera.trade.pnl.Lot lot = inLotFactory.create(); - org.marketcetera.admin.rpc.AdminRpcUtil.getUser(inLot.getUser(),inUserFactory).ifPresent(value->lot.setUser(value)); - org.marketcetera.trade.pnl.TradePnlRpcUtil.getTrade(inLot.getTrade(),inTradeFactory).ifPresent(value->lot.setTrade(value)); - org.marketcetera.trade.pnl.TradePnlRpcUtil.getPnlPosition(inLot.getPosition(),inPositionFactory,inUserFactory).ifPresent(value->lot.setPosition(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getScaledQuantity(inLot.getQuantity()).ifPresent(value->lot.setQuantity(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getScaledQuantity(inLot.getAllocatedQuantity()).ifPresent(value->lot.setAllocatedQuantity(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getDateValue(inLot.getEffectiveDate()).ifPresent(value->lot.setEffectiveDate(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getScaledQuantity(inLot.getBasisPrice()).ifPresent(value->lot.setBasisPrice(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getScaledQuantity(inLot.getGain()).ifPresent(value->lot.setGain(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getScaledQuantity(inLot.getTradePrice()).ifPresent(value->lot.setTradePrice(value)); - return java.util.Optional.of(lot); + Lot lot = inLotFactory.create(); + AdminRpcUtil.getUser(inLot.getUser(),inUserFactory).ifPresent(value->lot.setUser(value)); + TradePnlRpcUtil.getTrade(inLot.getTrade(),inTradeFactory).ifPresent(value->lot.setTrade(value)); + TradePnlRpcUtil.getPnlPosition(inLot.getPosition(),inPositionFactory,inUserFactory).ifPresent(value->lot.setPosition(value)); + BaseRpcUtil.getScaledQuantity(inLot.getQuantity()).ifPresent(value->lot.setQuantity(value)); + BaseRpcUtil.getScaledQuantity(inLot.getAllocatedQuantity()).ifPresent(value->lot.setAllocatedQuantity(value)); + BaseRpcUtil.getDateValue(inLot.getEffectiveDate()).ifPresent(value->lot.setEffectiveDate(value)); + BaseRpcUtil.getScaledQuantity(inLot.getBasisPrice()).ifPresent(value->lot.setBasisPrice(value)); + BaseRpcUtil.getScaledQuantity(inLot.getGain()).ifPresent(value->lot.setGain(value)); + BaseRpcUtil.getScaledQuantity(inLot.getTradePrice()).ifPresent(value->lot.setTradePrice(value)); + return Optional.of(lot); } /** * Get the object from the given RPC value. * - * @param inTrade a org.marketcetera.trade.pnl.TradePnlTypesRpc.Trade value - * @param inTradeFactory a org.marketcetera.trade.pnl.TradeFactory value - * @return a org.marketcetera.trade.pnl.Trade value + * @param inTrade a TradePnlTypesRpc.Trade value + * @param inTradeFactory a TradeFactory value + * @return an Optional<Trade> value */ - public static java.util.Optional getTrade(org.marketcetera.trade.pnl.TradePnlTypesRpc.Trade inTrade,org.marketcetera.trade.pnl.TradeFactory inTradeFactory) + public static Optional getTrade(TradePnlTypesRpc.Trade inTrade, + TradeFactory inTradeFactory) { if(inTrade == null) { - return java.util.Optional.empty(); + return Optional.empty(); } - org.marketcetera.trade.pnl.Trade trade = inTradeFactory.create(); - org.marketcetera.trading.rpc.TradeRpcUtil.getInstrument(inTrade.getInstrument()).ifPresent(value->trade.setInstrument(value)); - org.marketcetera.trading.rpc.TradeRpcUtil.getOrderId(inTrade.getExecutionId()).ifPresent(value->trade.setExecutionId(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getScaledQuantity(inTrade.getPrice()).ifPresent(value->trade.setPrice(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getScaledQuantity(inTrade.getQuantity()).ifPresent(value->trade.setQuantity(value)); - org.marketcetera.rpc.base.BaseRpcUtil.getDateValue(inTrade.getTransactionTime()).ifPresent(value->trade.setTransactionTime(value)); - return java.util.Optional.of(trade); + Trade trade = inTradeFactory.create(); + TradeRpcUtil.getInstrument(inTrade.getInstrument()).ifPresent(value->trade.setInstrument(value)); + TradeRpcUtil.getOrderId(inTrade.getExecutionId()).ifPresent(value->trade.setExecutionId(value)); + BaseRpcUtil.getScaledQuantity(inTrade.getPrice()).ifPresent(value->trade.setPrice(value)); + BaseRpcUtil.getScaledQuantity(inTrade.getQuantity()).ifPresent(value->trade.setQuantity(value)); + BaseRpcUtil.getDateValue(inTrade.getTransactionTime()).ifPresent(value->trade.setTransactionTime(value)); + return Optional.of(trade); } /** * Get the object from the given RPC value. * - * @param inUserTrade a org.marketcetera.trade.pnl.TradePnlTypesRpc.UserTrade value - * @param inUserTradeFactory a org.marketcetera.trade.pnl.UserTradeFactory value - * @param inTradeFactory a org.marketcetera.trade.pnl.TradeFactory value - * @param inProfitAndLossFactory a org.marketcetera.trade.pnl.ProfitAndLossFactory value - * @param inUserFactory a org.marketcetera.admin.UserFactory value - * @return a org.marketcetera.trade.pnl.UserTrade value + * @param inUserTrade a TradePnlTypesRpc.UserTrade value + * @param inUserTradeFactory a UserTradeFactory value + * @param inTradeFactory a TradeFactory value + * @param inProfitAndLossFactory a ProfitAndLossFactory value + * @param inUserFactory a UserFactory value + * @return an Optional<UserTrade> value */ - public static java.util.Optional getUserTrade(org.marketcetera.trade.pnl.TradePnlTypesRpc.UserTrade inUserTrade,org.marketcetera.trade.pnl.UserTradeFactory inUserTradeFactory,org.marketcetera.trade.pnl.TradeFactory inTradeFactory,org.marketcetera.trade.pnl.ProfitAndLossFactory inProfitAndLossFactory,org.marketcetera.admin.UserFactory inUserFactory) + public static Optional getUserTrade(TradePnlTypesRpc.UserTrade inUserTrade, + UserTradeFactory inUserTradeFactory, + TradeFactory inTradeFactory, + ProfitAndLossFactory inProfitAndLossFactory, + UserFactory inUserFactory) { if(inUserTrade == null) { - return java.util.Optional.empty(); + return Optional.empty(); } - org.marketcetera.trade.pnl.UserTrade userTrade = inUserTradeFactory.create(); - org.marketcetera.trade.pnl.TradePnlRpcUtil.getTrade(inUserTrade.getTrade(),inTradeFactory).ifPresent(value->userTrade.setTrade(value)); - org.marketcetera.admin.rpc.AdminRpcUtil.getUser(inUserTrade.getUser(),inUserFactory).ifPresent(value->userTrade.setUser(value)); - userTrade.setSide(org.marketcetera.trading.rpc.TradeRpcUtil.getSide(inUserTrade.getSide())); - org.marketcetera.trade.pnl.TradePnlRpcUtil.getProfitAndLoss(inUserTrade.getProfitAndLoss(),inProfitAndLossFactory,inUserFactory).ifPresent(value->userTrade.setProfitAndLoss(value)); - org.marketcetera.trading.rpc.TradeRpcUtil.getOrderId(inUserTrade.getOrderId()).ifPresent(value->userTrade.setOrderId(value)); - return java.util.Optional.of(userTrade); + UserTrade userTrade = inUserTradeFactory.create(); + TradePnlRpcUtil.getTrade(inUserTrade.getTrade(),inTradeFactory).ifPresent(value->userTrade.setTrade(value)); + AdminRpcUtil.getUser(inUserTrade.getUser(),inUserFactory).ifPresent(value->userTrade.setUser(value)); + userTrade.setSide(TradeRpcUtil.getSide(inUserTrade.getSide())); + TradePnlRpcUtil.getProfitAndLoss(inUserTrade.getProfitAndLoss(),inProfitAndLossFactory,inUserFactory).ifPresent(value->userTrade.setProfitAndLoss(value)); + TradeRpcUtil.getOrderId(inUserTrade.getOrderId()).ifPresent(value->userTrade.setOrderId(value)); + return Optional.of(userTrade); } } diff --git a/trade/trade-rpc-core/src/main/java/org/marketcetera/trading/rpc/TradeRpcUtil.java b/trade/trade-rpc-core/src/main/java/org/marketcetera/trading/rpc/TradeRpcUtil.java index 73d6fcd89e..f070260322 100644 --- a/trade/trade-rpc-core/src/main/java/org/marketcetera/trading/rpc/TradeRpcUtil.java +++ b/trade/trade-rpc-core/src/main/java/org/marketcetera/trading/rpc/TradeRpcUtil.java @@ -55,10 +55,16 @@ import org.marketcetera.trade.OrderBase; import org.marketcetera.trade.OrderCancel; import org.marketcetera.trade.OrderCancelReject; +import org.marketcetera.trade.OrderCancelSuggestion; +import org.marketcetera.trade.OrderCancelSuggestionImpl; import org.marketcetera.trade.OrderCapacity; import org.marketcetera.trade.OrderID; import org.marketcetera.trade.OrderReplace; +import org.marketcetera.trade.OrderReplaceSuggestion; +import org.marketcetera.trade.OrderReplaceSuggestionImpl; import org.marketcetera.trade.OrderSingle; +import org.marketcetera.trade.OrderSingleSuggestion; +import org.marketcetera.trade.OrderSingleSuggestionImpl; import org.marketcetera.trade.OrderStatus; import org.marketcetera.trade.OrderSummary; import org.marketcetera.trade.OrderType; @@ -71,6 +77,7 @@ import org.marketcetera.trade.ReportType; import org.marketcetera.trade.SecurityType; import org.marketcetera.trade.Side; +import org.marketcetera.trade.Suggestion; import org.marketcetera.trade.TimeInForce; import org.marketcetera.trade.TradeMessage; import org.marketcetera.trade.UserID; @@ -1121,7 +1128,7 @@ public static void setDisplayQuantity(NewOrReplaceOrder inOrder, * Set the order ID from the given RPC order. * * @param inOrder an OrderBase value - * @param inBuilder a TradeTypesRpc.OrderBase.Builder value + * @param inRpcOrder a TradeTypesRpc.OrderBase.Builder value */ public static void setOrderId(OrderBase inOrder, TradeTypesRpc.OrderBase inRpcOrder) @@ -1136,7 +1143,7 @@ public static void setOrderId(OrderBase inOrder, * Set the original order ID from the given RPC order. * * @param inOrder a RelatedOrder value - * @param inBuilder a TradeTypesRpc.OrderBase.Builder value + * @param inRpcOrder a TradeTypesRpc.OrderBase.Builder value */ public static void setOriginalOrderId(RelatedOrder inOrder, TradeTypesRpc.OrderBase inRpcOrder) @@ -1151,7 +1158,7 @@ public static void setOriginalOrderId(RelatedOrder inOrder, * Set the broker order ID from the given RPC order. * * @param inOrder a RelatedOrder value - * @param inBuilder a TradeTypesRpc.OrderBase.Builder value + * @param inRpcOrder a TradeTypesRpc.OrderBase.Builder value */ public static void setBrokerOrderId(RelatedOrder inOrder, TradeTypesRpc.OrderBase inRpcOrder) @@ -1166,7 +1173,7 @@ public static void setBrokerOrderId(RelatedOrder inOrder, * Set the broker ID from the given RPC order. * * @param inOrder an OrderBase value - * @param inBuilder a TradeTypesRpc.OrderBase.Builder value + * @param inRpcOrder a TradeTypesRpc.OrderBase.Builder value */ public static void setBrokerId(OrderBase inOrder, TradeTypesRpc.OrderBase inRpcOrder) @@ -1181,7 +1188,7 @@ public static void setBrokerId(OrderBase inOrder, * Set the instrument from the given RPC order. * * @param inOrder an OrderBase value - * @param inBuilder a TradeTypesRpc.OrderBase.Builder value + * @param inRpcOrder a TradeTypesRpc.OrderBase.Builder value */ public static void setInstrument(OrderBase inOrder, TradeTypesRpc.OrderBase inRpcOrder) @@ -1194,7 +1201,7 @@ public static void setInstrument(OrderBase inOrder, * Set the account from the given RPC order. * * @param inOrder an OrderBase value - * @param inBuilder a TradeTypesRpc.OrderBase.Builder value + * @param inRpcOrder a TradeTypesRpc.OrderBase.Builder value */ public static void setAccount(OrderBase inOrder, TradeTypesRpc.OrderBase inRpcOrder) @@ -1208,7 +1215,7 @@ public static void setAccount(OrderBase inOrder, * Set the text from the given RPC order. * * @param inOrder an OrderBase value - * @param inBuilder a TradeTypesRpc.OrderBase.Builder value + * @param inRpcOrder a TradeTypesRpc.OrderBase.Builder value */ public static void setText(OrderBase inOrder, TradeTypesRpc.OrderBase inRpcOrder) @@ -1222,7 +1229,7 @@ public static void setText(OrderBase inOrder, * Set the execution destination from the given RPC order. * * @param inOrder a NewOrReplaceOrder value - * @param inBuilder a TradeTypesRpc.OrderBase.Builder value + * @param inRpcOrder a TradeTypesRpc.OrderBase.Builder value */ public static void setExecutionDestination(NewOrReplaceOrder inOrder, TradeTypesRpc.OrderBase inRpcOrder) @@ -1251,7 +1258,7 @@ public static void setExecutionDestination(NewOrReplaceOrder inOrder, * Set the peg-to-midpoint value from the given RPC order. * * @param inOrder a NewOrReplaceOrder value - * @param inBuilder a TradeTypesRpc.OrderBase.Builder value + * @param inRpcOrder a TradeTypesRpc.OrderBase.Builder value */ public static void setPegToMidpoint(NewOrReplaceOrder inOrder, TradeTypesRpc.OrderBase inRpcOrder) @@ -1262,7 +1269,7 @@ public static void setPegToMidpoint(NewOrReplaceOrder inOrder, * Set the broker algo from the given RPC order. * * @param inOrder a NewOrReplaceOrder value - * @param inBuilder a TradeTypesRpc.OrderBase.Builder value + * @param inRpcOrder a TradeTypesRpc.OrderBase.Builder value */ public static void setBrokerAlgo(NewOrReplaceOrder inOrder, TradeTypesRpc.OrderBase inRpcOrder) @@ -1481,7 +1488,7 @@ public static Optional getBrokerId(Object inObject) /** * Get the broker order ID from the given RPC report. * - * @param inObject a TradeTypesRpc.Report value + * @param inReport a TradeTypesRpc.Report value * @return an Optional<OrderID> value */ public static Optional getBrokerOrderId(TradeTypesRpc.Report inReport) @@ -1578,6 +1585,169 @@ public static Order getOrder(TradeTypesRpc.Order inRpcOrder) } return orderBase; } + /** + * Get the suggestion value from the given RPC message. + * + * @param inResponse a TradeRpc.SuggestionListenerResponse value + * @return a Suggestion value + */ + public static Suggestion getSuggestion(TradeRpc.SuggestionListenerResponse inResponse) + { + if(!inResponse.hasSuggestion()) { + throw new UnsupportedOperationException(); + } + return getSuggestion(inResponse.getSuggestion()); + } + /** + * Get the suggestion value from the given RPC value. + * + * @param inRpcSuggestion a TradeTypesRpc.Suggestion value + * @return a Suggestion value + */ + public static Suggestion getSuggestion(TradeTypesRpc.Suggestion inRpcSuggestion) + { + Order order = getOrder(inRpcSuggestion.getOrder()); + Suggestion suggestion; + if(order instanceof OrderSingle) { + suggestion = new OrderSingleSuggestionImpl(); + ((OrderSingleSuggestionImpl)suggestion).setOrder((OrderSingle)order); + } else if(order instanceof OrderReplace) { + suggestion = new OrderReplaceSuggestionImpl((OrderReplace)order); + } else if(order instanceof OrderCancel) { + suggestion = new OrderCancelSuggestionImpl((OrderCancel)order); + } else { + throw new UnsupportedOperationException("Unexpected RPC order type: " + inRpcSuggestion.getOrder().getMatpOrderTypeValue()); + } + suggestion.setIdentifier(inRpcSuggestion.getIdentifier()); + BaseRpcUtil.getScaledQuantity(inRpcSuggestion.getScore()).ifPresent(qty -> suggestion.setScore(qty)); + return suggestion; + } + /** + * Set the suggestion value into the given RPC builder, if possible. + * + * @param inSuggestion a Suggestion value + * @param inResponseBuilder a TradeRpc.SuggestionListenerResponse.Builder value + */ + public static void setSuggestion(Suggestion inSuggestion, + TradeRpc.SuggestionListenerResponse.Builder inResponseBuilder) + { + getSuggestion(inSuggestion).ifPresent(rpcSuggestion -> inResponseBuilder.setSuggestion(rpcSuggestion)); + } + /** + * Get the RPC suggestion value from the given value. + * + * @param inSuggestion a Suggestion value + * @return an Optional<TradeTypesRpc.Suggestion> value + */ + public static Optional getSuggestion(Suggestion inSuggestion) + { + if(inSuggestion == null) { + return Optional.empty(); + } + TradeTypesRpc.Suggestion.Builder builder = TradeTypesRpc.Suggestion.newBuilder(); + builder.setIdentifier(inSuggestion.getIdentifier()); + BaseRpcUtil.getRpcQty(inSuggestion.getScore()).ifPresent(rpcQty -> builder.setScore(rpcQty)); + if(inSuggestion instanceof OrderSingleSuggestion) { + OrderSingleSuggestion suggestion = (OrderSingleSuggestion)inSuggestion; + getOrder(suggestion.getOrder()).ifPresent(rpcOrder -> builder.setOrder(rpcOrder)); + } else if(inSuggestion instanceof OrderReplaceSuggestion) { + OrderReplaceSuggestion suggestion = (OrderReplaceSuggestion)inSuggestion; + getOrder(suggestion.getOrderReplace()).ifPresent(rpcOrder -> builder.setOrder(rpcOrder)); + } else if(inSuggestion instanceof OrderCancelSuggestion) { + OrderCancelSuggestion suggestion = (OrderCancelSuggestion)inSuggestion; + getOrder(suggestion.getOrderCancel()).ifPresent(rpcOrder -> builder.setOrder(rpcOrder)); + } else { + throw new UnsupportedOperationException("Unexpected suggestion type: " + inSuggestion.getClass().getSimpleName()); + } + return Optional.of(builder.build()); + } + /** + * Get the RPC order value from the given value. + * + * @param inOrder an Order value + */ + public static Optional getOrder(Order inOrder) + { + if(inOrder == null) { + return Optional.empty(); + } + TradeTypesRpc.Order.Builder orderBuilder = TradeTypesRpc.Order.newBuilder(); + TradeTypesRpc.OrderBase.Builder orderBaseBuilder = TradeTypesRpc.OrderBase.newBuilder(); + if(inOrder instanceof FIXOrder) { + FIXOrder fixOrder = (FIXOrder)inOrder; + TradeTypesRpc.FIXOrder.Builder fixOrderBuilder = TradeTypesRpc.FIXOrder.newBuilder(); + BaseRpc.Map.Builder mapBuilder = BaseRpc.Map.newBuilder(); + BaseRpc.KeyValuePair.Builder keyValuePairBuilder = BaseRpc.KeyValuePair.newBuilder(); + for(Map.Entry entry : fixOrder.getFields().entrySet()) { + keyValuePairBuilder.setKey(String.valueOf(entry.getKey())); + keyValuePairBuilder.setValue(entry.getValue()); + mapBuilder.addKeyValuePairs(keyValuePairBuilder.build()); + } + orderBuilder.setMatpOrderType(TradeTypesRpc.MatpOrderType.FIXOrderType); + TradeRpcUtil.setBrokerId(fixOrder, + fixOrderBuilder); + // TODO +// fixOrderBuilder.setMessage(mapBuilder.build()); + orderBuilder.setFixOrder(fixOrderBuilder.build()); + } else if(inOrder instanceof OrderBase) { + // either an OrderSingle, OrderReplace, or OrderCancel + // the types overlap some, first, set all the common fields on OrderBase + OrderBase orderBase = (OrderBase)inOrder; + TradeRpcUtil.setAccount(orderBase, + orderBaseBuilder); + TradeRpcUtil.setBrokerId(orderBase, + orderBaseBuilder); + TradeRpcUtil.setRpcCustomFields(orderBase, + orderBaseBuilder); + TradeRpcUtil.setInstrument(orderBase, + orderBaseBuilder); + TradeRpcUtil.setOrderId(orderBase, + orderBaseBuilder); + TradeRpcUtil.setQuantity(orderBase, + orderBaseBuilder); + TradeRpcUtil.setSide(orderBase, + orderBaseBuilder); + TradeRpcUtil.setText(orderBase, + orderBaseBuilder); + // now, check for various special order types + if(orderBase instanceof NewOrReplaceOrder) { + NewOrReplaceOrder newOrReplaceOrder = (NewOrReplaceOrder)orderBase; + TradeRpcUtil.setDisplayQuantity(newOrReplaceOrder, + orderBaseBuilder); + TradeRpcUtil.setExecutionDestination(newOrReplaceOrder, + orderBaseBuilder); + TradeRpcUtil.setOrderCapacity(newOrReplaceOrder, + orderBaseBuilder); + TradeRpcUtil.setOrderType(newOrReplaceOrder, + orderBaseBuilder); + TradeRpcUtil.setPositionEffect(newOrReplaceOrder, + orderBaseBuilder); + TradeRpcUtil.setPrice(newOrReplaceOrder, + orderBaseBuilder); + TradeRpcUtil.setTimeInForce(newOrReplaceOrder, + orderBaseBuilder); + } + if(inOrder instanceof RelatedOrder) { + RelatedOrder relatedOrder = (RelatedOrder)inOrder; + TradeRpcUtil.setOriginalOrderId(relatedOrder, + orderBaseBuilder); + } + TradeTypesRpc.OrderBase rpcOrderBase = orderBaseBuilder.build(); + orderBuilder.setOrderBase(rpcOrderBase); + if(inOrder instanceof OrderCancel) { + orderBuilder.setMatpOrderType(TradeTypesRpc.MatpOrderType.OrderCancelType); + } else if(inOrder instanceof OrderSingle) { + orderBuilder.setMatpOrderType(TradeTypesRpc.MatpOrderType.OrderSingleType); + } else if(inOrder instanceof OrderReplace) { + orderBuilder.setMatpOrderType(TradeTypesRpc.MatpOrderType.OrderReplaceType); + } else { + throw new UnsupportedOperationException("Unsupported order type: " + inOrder.getClass().getSimpleName()); + } + } else { + throw new UnsupportedOperationException("Unsupported order type: " + inOrder.getClass().getSimpleName()); + } + return Optional.of(orderBuilder.build()); + } /** * Get the trade message value from the given RPC message. * @@ -1594,7 +1764,7 @@ public static TradeMessage getTradeMessage(TradeMessageListenerResponse inRespon /** * Get the trade message value from the given RPC trade message. * - * @param inReport a TradeTypesRpc.TradeMessage value + * @param inRpcTradeMessage a TradeTypesRpc.TradeMessage value * @return a TradeMessage value */ public static TradeMessage getTradeMessage(TradeTypesRpc.TradeMessage inRpcTradeMessage) diff --git a/trade/trade-rpc-core/src/main/proto/rpc_trade.proto b/trade/trade-rpc-core/src/main/proto/rpc_trade.proto index 83c21e34d1..58dffb2539 100644 --- a/trade/trade-rpc-core/src/main/proto/rpc_trade.proto +++ b/trade/trade-rpc-core/src/main/proto/rpc_trade.proto @@ -87,6 +87,23 @@ message RemoveTradeMessageListenerRequest { message RemoveTradeMessageListenerResponse { } +message AddSuggestionListenerRequest { + string sessionId = 1; + string listenerId = 2; +} + +message SuggestionListenerResponse { + Suggestion suggestion = 1; +} + +message RemoveSuggestionListenerRequest { + string sessionId = 1; + string listenerId = 2; +} + +message RemoveSuggestionListenerResponse { +} + message ResolveSymbolRequest { string sessionId = 1; string symbol = 2; @@ -160,6 +177,14 @@ message ReadAvailableFixInitiatorSessionsResponse { repeated ActiveFixSession fixSession = 1; } +message SendSuggestionRequest { + string sessionId = 1; + repeated Suggestion suggestion = 2; +} + +message SendSuggestionResponse { +} + service TradeRpcService { rpc login(LoginRequest) returns (LoginResponse); rpc logout(LogoutRequest) returns (LogoutResponse); @@ -180,4 +205,7 @@ service TradeRpcService { rpc getReports(GetReportsRequest) returns (GetReportsResponse); rpc getFills(GetFillsRequest) returns (GetFillsResponse); rpc getAverageFillPrices(GetAverageFillPricesRequest) returns (GetAverageFillPricesResponse); + rpc addSuggestionListener(AddSuggestionListenerRequest) returns (stream SuggestionListenerResponse); + rpc removeSuggestionListener(RemoveSuggestionListenerRequest) returns (RemoveSuggestionListenerResponse); + rpc sendSuggestion(SendSuggestionRequest) returns (SendSuggestionResponse); } diff --git a/trade/trade-rpc-core/src/main/proto/rpc_trade_types.proto b/trade/trade-rpc-core/src/main/proto/rpc_trade_types.proto index 179ef9c286..89b4cfc03a 100644 --- a/trade/trade-rpc-core/src/main/proto/rpc_trade_types.proto +++ b/trade/trade-rpc-core/src/main/proto/rpc_trade_types.proto @@ -313,3 +313,9 @@ message Position { PositionKey positionKey = 1; Qty position = 2; } + +message Suggestion { + string identifier = 1; + Qty score = 2; + Order order = 3; +} diff --git a/trade/trade-rpc-server/.gitignore b/trade/trade-rpc-server/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/trade/trade-rpc-server/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/trade/trade-rpc-server/src/main/java/org/marketcetera/client/rpc/server/TradeRpcService.java b/trade/trade-rpc-server/src/main/java/org/marketcetera/trade/rpc/server/TradeRpcService.java similarity index 85% rename from trade/trade-rpc-server/src/main/java/org/marketcetera/client/rpc/server/TradeRpcService.java rename to trade/trade-rpc-server/src/main/java/org/marketcetera/trade/rpc/server/TradeRpcService.java index 05f5c6beee..a5701c0628 100644 --- a/trade/trade-rpc-server/src/main/java/org/marketcetera/client/rpc/server/TradeRpcService.java +++ b/trade/trade-rpc-server/src/main/java/org/marketcetera/trade/rpc/server/TradeRpcService.java @@ -1,4 +1,4 @@ -package org.marketcetera.client.rpc.server; +package org.marketcetera.trade.rpc.server; import java.math.BigDecimal; import java.time.Instant; @@ -44,6 +44,8 @@ import org.marketcetera.trade.OrderSummary; import org.marketcetera.trade.Report; import org.marketcetera.trade.ReportID; +import org.marketcetera.trade.Suggestion; +import org.marketcetera.trade.SuggestionListener; import org.marketcetera.trade.TradeMessage; import org.marketcetera.trade.TradeMessageListener; import org.marketcetera.trade.TradePermissions; @@ -78,8 +80,6 @@ import org.marketcetera.trade.rpc.TradeRpc.RemoveTradeMessageListenerResponse; import org.marketcetera.trade.rpc.TradeRpc.ResolveSymbolRequest; import org.marketcetera.trade.rpc.TradeRpc.ResolveSymbolResponse; -import org.marketcetera.trade.rpc.TradeRpc.SendOrderRequest; -import org.marketcetera.trade.rpc.TradeRpc.SendOrderResponse; import org.marketcetera.trade.rpc.TradeRpc.TradeMessageListenerResponse; import org.marketcetera.trade.rpc.TradeRpcServiceGrpc; import org.marketcetera.trade.rpc.TradeRpcServiceGrpc.TradeRpcServiceImplBase; @@ -330,11 +330,48 @@ public void getLatestExecutionReportForOrderChain(GetLatestExecutionReportForOrd } } /* (non-Javadoc) - * @see org.marketcetera.trade.rpc.TradeRpcServiceGrpc.TradeRpcServiceImplBase#sendOrders(org.marketcetera.trade.rpc.TradeRpc.SendOrderRequest, io.grpc.stub.StreamObserver) + * @see org.marketcetera.trade.rpc.TradeRpcServiceGrpc.TradeRpcServiceImplBase#sendSuggestion(org.marketcetera.trade.rpc.TradeRpc.SendSuggestionRequest, io.grpc.stub.StreamObserver) */ @Override - public void sendOrders(SendOrderRequest inRequest, - StreamObserver inResponseObserver) + public void sendSuggestion(TradeRpc.SendSuggestionRequest inRequest, + StreamObserver inResponseObserver) + { + try { + SessionHolder sessionHolder = validateAndReturnSession(inRequest.getSessionId()); + SLF4JLoggerProxy.trace(TradeRpcService.this, + "Received send suggestion request {} from {}", + inRequest, + sessionHolder); + authzService.authorize(sessionHolder.getUser(), + TradePermissions.SendSuggestionAction.name()); + TradeRpc.SendSuggestionResponse.Builder responseBuilder = TradeRpc.SendSuggestionResponse.newBuilder(); + for(TradeTypesRpc.Suggestion rpcSuggestion : inRequest.getSuggestionList()) { + try { + Suggestion matpSuggestion = TradeRpcUtil.getSuggestion(rpcSuggestion); +// User user = userService.findByName(sessionHolder.getUser()); + // TODO need to attach a user to a suggestion + tradeService.reportSuggestion(matpSuggestion); + } catch (Exception e) { + SLF4JLoggerProxy.warn(TradeRpcService.this, + e, + "Unable to submit order {}", + rpcSuggestion); + } + } + TradeRpc.SendSuggestionResponse response = responseBuilder.build(); + inResponseObserver.onNext(response); + inResponseObserver.onCompleted(); + } catch (Exception e) { + handleError(e, + inResponseObserver); + } + } + /* (non-Javadoc) + * @see org.marketcetera.trade.rpc.TradeRpcServiceGrpc.TradeRpcServiceImplBase#sendSuggestions(org.marketcetera.trade.rpc.TradeRpc.SendOrderRequest, io.grpc.stub.StreamObserver) + */ + @Override + public void sendOrders(TradeRpc.SendOrderRequest inRequest, + StreamObserver inResponseObserver) { try { SessionHolder sessionHolder = validateAndReturnSession(inRequest.getSessionId()); @@ -405,6 +442,63 @@ public void resolveSymbol(ResolveSymbolRequest inRequest, inResponseObserver); } } + /* (non-Javadoc) + * @see org.marketcetera.trade.rpc.TradeRpcServiceGrpc.TradeRpcServiceImplBase#addSuggestionListener(org.marketcetera.trade.rpc.TradeRpc.AddSuggestionListenerRequest, io.grpc.stub.StreamObserver) + */ + @Override + public void addSuggestionListener(TradeRpc.AddSuggestionListenerRequest inRequest, + StreamObserver inResponseObserver) + { + try { + validateAndReturnSession(inRequest.getSessionId()); + SLF4JLoggerProxy.trace(TradeRpcService.this, + "Received add suggestion listener request {}", + inRequest); + String listenerId = inRequest.getListenerId(); + BaseRpcUtil.AbstractServerListenerProxy suggestionListenerProxy = listenerProxiesById.getIfPresent(listenerId); + if(suggestionListenerProxy == null) { + suggestionListenerProxy = new SuggestionListenerProxy(listenerId, + inResponseObserver); + listenerProxiesById.put(suggestionListenerProxy.getId(), + suggestionListenerProxy); + tradeService.addSuggestionListener((SuggestionListener)suggestionListenerProxy); + } + } catch (Exception e) { + handleError(e, + inResponseObserver); + } + } + /* (non-Javadoc) + * @see org.marketcetera.trade.rpc.TradeRpcServiceGrpc.TradeRpcServiceImplBase#removeSuggestionListener(org.marketcetera.trade.rpc.TradeRpc.RemoveSuggestionListenerRequest, io.grpc.stub.StreamObserver) + */ + @Override + public void removeSuggestionListener(TradeRpc.RemoveSuggestionListenerRequest inRequest, + StreamObserver inResponseObserver) + { + try { + validateAndReturnSession(inRequest.getSessionId()); + SLF4JLoggerProxy.trace(TradeRpcService.this, + "Received remove suggestion listener request {}", + inRequest); + String listenerId = inRequest.getListenerId(); + BaseRpcUtil.AbstractServerListenerProxy suggestionListenerProxy = listenerProxiesById.getIfPresent(listenerId); + listenerProxiesById.invalidate(listenerId); + if(suggestionListenerProxy != null) { + tradeService.removeSuggestionListener((SuggestionListener)suggestionListenerProxy); + suggestionListenerProxy.close(); + } + TradeRpc.RemoveSuggestionListenerResponse.Builder responseBuilder = TradeRpc.RemoveSuggestionListenerResponse.newBuilder(); + TradeRpc.RemoveSuggestionListenerResponse response = responseBuilder.build(); + SLF4JLoggerProxy.trace(TradeRpcService.this, + "Returning {}", + response); + inResponseObserver.onNext(response); + inResponseObserver.onCompleted(); + } catch (Exception e) { + handleError(e, + inResponseObserver); + } + } /* (non-Javadoc) * @see org.marketcetera.trade.rpc.TradeRpcServiceGrpc.TradeRpcServiceImplBase#addTradeMessageListener(org.marketcetera.trade.rpc.TradeRpc.AddTradeMessageListenerRequest, io.grpc.stub.StreamObserver) */ @@ -840,6 +934,52 @@ private TradeMessageListenerProxy(String inId, */ private final TradeRpc.TradeMessageListenerResponse.Builder responseBuilder = TradeRpc.TradeMessageListenerResponse.newBuilder(); } + /** + * Wraps a {@link SuggestionListener} with the RPC call from the client. + * + * @author Colin DuPlantis + * @version $Id$ + * @since $Release$ + */ + private static class SuggestionListenerProxy + extends BaseRpcUtil.AbstractServerListenerProxy + implements SuggestionListener + { + /* (non-Javadoc) + * @see org.marketcetera.trade.TradeMessageListener#receiveTradeMessage(org.marketcetera.trade.TradeMessage) + */ + @Override + public void receiveSuggestion(Suggestion inSuggestion) + { + TradeRpcUtil.setSuggestion(inSuggestion, + responseBuilder); + TradeRpc.SuggestionListenerResponse response = responseBuilder.build(); + SLF4JLoggerProxy.trace(TradeRpcService.class, + "{} received suggestion {}, sending {}", + getId(), + inSuggestion, + response); + // TODO does the user have permissions (including supervisor) to view this report? + getObserver().onNext(response); + responseBuilder.clear(); + } + /** + * Create a new SuggestionListenerProxy instance. + * + * @param inId a String value + * @param inObserver a StreamObserver<TradeRpc.SuggestionListenerResponse> value + */ + private SuggestionListenerProxy(String inId, + StreamObserver inObserver) + { + super(inId, + inObserver); + } + /** + * builder used to construct messages + */ + private final TradeRpc.SuggestionListenerResponse.Builder responseBuilder = TradeRpc.SuggestionListenerResponse.newBuilder(); + } /** * provides authorization services */ diff --git a/trade/trade-server/.gitignore b/trade/trade-server/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/trade/trade-server/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/trade/trade-server/src/main/java/org/marketcetera/trade/client/DirectTradeClient.java b/trade/trade-server/src/main/java/org/marketcetera/trade/client/DirectTradeClient.java index 7376732ef2..2f0b88d093 100644 --- a/trade/trade-server/src/main/java/org/marketcetera/trade/client/DirectTradeClient.java +++ b/trade/trade-server/src/main/java/org/marketcetera/trade/client/DirectTradeClient.java @@ -6,14 +6,14 @@ import java.util.List; import java.util.Map; +import javax.annotation.PostConstruct; + import org.apache.commons.lang.Validate; import org.apache.commons.lang.exception.ExceptionUtils; -import org.apache.commons.lang3.StringUtils; +import org.marketcetera.admin.HasCurrentUser; import org.marketcetera.admin.User; -import org.marketcetera.admin.service.UserService; import org.marketcetera.brokers.service.BrokerService; import org.marketcetera.core.ClientStatusListener; -import org.marketcetera.core.PlatformServices; import org.marketcetera.core.position.PositionKey; import org.marketcetera.event.HasFIXMessage; import org.marketcetera.fix.ActiveFixSession; @@ -33,13 +33,15 @@ import org.marketcetera.trade.Report; import org.marketcetera.trade.ReportID; import org.marketcetera.trade.SendOrderFailed; +import org.marketcetera.trade.Suggestion; +import org.marketcetera.trade.SuggestionListener; import org.marketcetera.trade.TradeMessageListener; import org.marketcetera.trade.TradeMessagePublisher; import org.marketcetera.trade.service.OrderSummaryService; import org.marketcetera.trade.service.ReportService; import org.marketcetera.trade.service.TradeService; import org.marketcetera.util.log.SLF4JLoggerProxy; -import org.springframework.context.ApplicationContext; +import org.springframework.beans.factory.annotation.Autowired; import com.google.common.collect.Lists; @@ -59,25 +61,12 @@ public class DirectTradeClient * @see org.marketcetera.core.BaseClient#start() */ @Override + @PostConstruct public void start() throws Exception { SLF4JLoggerProxy.info(this, "Starting direct trade client"); - Validate.notNull(applicationContext); - userService = applicationContext.getBean(UserService.class); - orderSummaryService = applicationContext.getBean(OrderSummaryService.class); - tradeMessagePublisher = applicationContext.getBean(TradeMessagePublisher.class); - reportService = applicationContext.getBean(ReportService.class); - tradeService = applicationContext.getBean(TradeService.class); - brokerService = applicationContext.getBean(BrokerService.class); - symbolResolverService = applicationContext.getBean(SymbolResolverService.class); - SLF4JLoggerProxy.debug(this, - "Direct client {} owned by user {}", - clientId, - username); - user = userService.findByName(username); - Validate.notNull(user); running = true; } /* (non-Javadoc) @@ -118,6 +107,22 @@ public void removeTradeMessageListener(TradeMessageListener inTradeMessageListen { tradeMessagePublisher.removeTradeMessageListener(inTradeMessageListener); } + /* (non-Javadoc) + * @see org.marketcetera.trade.client.TradeClient#addSuggestionListener(org.marketcetera.trade.SuggestionListener) + */ + @Override + public void addSuggestionListener(SuggestionListener inSuggestionListener) + { + tradeService.addSuggestionListener(inSuggestionListener); + } + /* (non-Javadoc) + * @see org.marketcetera.trade.client.TradeClient#removeSuggestionListener(org.marketcetera.trade.SuggestionListener) + */ + @Override + public void removeSuggestionListener(SuggestionListener inSuggestionListener) + { + tradeService.removeSuggestionListener(inSuggestionListener); + } /* (non-Javadoc) * @see org.marketcetera.trade.client.TradeClient#getOpenOrders() */ @@ -173,6 +178,7 @@ public List sendOrders(List inOrders) @Override public SendOrderResponse sendOrder(Order inOrder) { + validateUser(); SLF4JLoggerProxy.info(this, "{} submitting outgoing {}", user.getName(), @@ -193,6 +199,14 @@ public SendOrderResponse sendOrder(Order inOrder) response.setOrderId(orderId); return response; } + /* (non-Javadoc) + * @see org.marketcetera.trade.client.TradeClient#sendOrderSuggestion(org.marketcetera.trade.Suggestion) + */ + @Override + public void sendOrderSuggestion(Suggestion inSuggestion) + { + tradeService.reportSuggestion(inSuggestion); + } /* (non-Javadoc) * @see org.marketcetera.trade.client.TradeClient#getPositionAsOf(java.util.Date, org.marketcetera.trade.Instrument) */ @@ -210,6 +224,7 @@ public BigDecimal getPositionAsOf(Date inDate, @Override public Map,BigDecimal> getAllPositionsAsOf(Date inDate) { + validateUser(); return reportService.getAllPositionsAsOf(user, inDate); } @@ -220,6 +235,7 @@ public Map,BigDecimal> getAllPositionsAsOf(Dat public Map,BigDecimal> getOptionPositionsAsOf(Date inDate, String... inRootSymbols) { + validateUser(); return reportService.getOptionPositionsAsOf(user, inDate, inRootSymbols); @@ -231,6 +247,7 @@ public Map,BigDecimal> getOptionPositionsAsOf(Date inDate, public void addReport(HasFIXMessage inReport, BrokerID inBrokerID) { + validateUser(); reportService.addReport(inReport, inBrokerID, user.getUserID()); @@ -316,44 +333,34 @@ public void removeClientStatusListener(ClientStatusListener inListener) // no-op } /** - * Get the applicationContext value. + * Get the currentUser value. * - * @return an ApplicationContext value + * @return a HasCurrentUser value */ - public ApplicationContext getApplicationContext() + public HasCurrentUser getCurrentUser() { - return applicationContext; + return currentUser; } /** - * Sets the applicationContext value. + * Sets the currentUser value. * - * @param inApplicationContext an ApplicationContext value + * @param inCurrentUser a HasCurrentUser value */ - public void setApplicationContext(ApplicationContext inApplicationContext) + public void setCurrentUser(HasCurrentUser inCurrentUser) { - applicationContext = inApplicationContext; + currentUser = inCurrentUser; } /** - * Create a new DirectTradeClient instance. - * - * @param inApplicationContext an ApplicationContext value - * @param inUsername a String value + * Validate that the user is set. */ - protected DirectTradeClient(ApplicationContext inApplicationContext, - String inUsername) + private void validateUser() { - applicationContext = inApplicationContext; - username = StringUtils.trimToNull(inUsername); - Validate.notNull(username); + if(user == null) { + Validate.notNull(currentUser, + "Must provide a HasCurrentUser to " + getClass().getSimpleName()); + user = currentUser.getUser(); + } } - /** - * provides access to the application context - */ - private ApplicationContext applicationContext; - /** - * name of user - */ - private final String username; /** * user which owns the activity of this client */ @@ -363,37 +370,40 @@ protected DirectTradeClient(ApplicationContext inApplicationContext, */ private boolean running = false; /** - * provides access to user services + * provides access to the current user */ - private UserService userService; + @Autowired(required=false) + private HasCurrentUser currentUser; /** * provides access to broker services */ + @Autowired private BrokerService brokerService; /** * provides access to trade messages */ + @Autowired private TradeMessagePublisher tradeMessagePublisher; /** * provides access to report services */ + @Autowired private ReportService reportService; /** * provides access to trade services */ + @Autowired private TradeService tradeService; /** * provides access to order summary services */ + @Autowired private OrderSummaryService orderSummaryService; /** * resolves symbols */ + @Autowired private SymbolResolverService symbolResolverService; - /** - * uniquely identifies this client - */ - private final String clientId = PlatformServices.generateId(); /** * order id for unknown orders */ diff --git a/trade/trade-server/src/main/java/org/marketcetera/trade/client/DirectTradeClientFactory.java b/trade/trade-server/src/main/java/org/marketcetera/trade/client/DirectTradeClientFactory.java index 0263fde722..0feb1d32fd 100644 --- a/trade/trade-server/src/main/java/org/marketcetera/trade/client/DirectTradeClientFactory.java +++ b/trade/trade-server/src/main/java/org/marketcetera/trade/client/DirectTradeClientFactory.java @@ -1,8 +1,5 @@ package org.marketcetera.trade.client; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; - /* $License$ */ /** @@ -21,13 +18,6 @@ public class DirectTradeClientFactory @Override public TradeClient create(DirectTradeClientParameters inParameterClazz) { - DirectTradeClient tradeClient = new DirectTradeClient(applicationContext, - inParameterClazz.getUsername()); - return tradeClient; + return new DirectTradeClient(); } - /** - * provides access to the application context - */ - @Autowired - private ApplicationContext applicationContext; } diff --git a/trade/trade-server/src/main/java/org/marketcetera/trade/dao/DatabaseIDFactory.java b/trade/trade-server/src/main/java/org/marketcetera/trade/dao/DatabaseIDFactory.java index c5fce41f60..f3a55f2faf 100644 --- a/trade/trade-server/src/main/java/org/marketcetera/trade/dao/DatabaseIDFactory.java +++ b/trade/trade-server/src/main/java/org/marketcetera/trade/dao/DatabaseIDFactory.java @@ -49,7 +49,7 @@ public long getCacheQuantity() /** * Sets the cacheQuantity value. * - * @param a long value + * @param inCacheQuantity a long value */ public void setCacheQuantity(long inCacheQuantity) { diff --git a/trade/trade-server/src/main/java/org/marketcetera/trade/dao/PersistentDatabaseID.java b/trade/trade-server/src/main/java/org/marketcetera/trade/dao/PersistentDatabaseID.java index 1885dcd40f..deb882a827 100644 --- a/trade/trade-server/src/main/java/org/marketcetera/trade/dao/PersistentDatabaseID.java +++ b/trade/trade-server/src/main/java/org/marketcetera/trade/dao/PersistentDatabaseID.java @@ -36,7 +36,7 @@ public long getNextAllowedId() /** * Sets the nextAllowedId value. * - * @param a long value + * @param inNextAllowedId a long value */ public void setNextAllowedId(long inNextAllowedId) { diff --git a/trade/trade-server/src/main/java/org/marketcetera/trade/dao/PersistentReport.java b/trade/trade-server/src/main/java/org/marketcetera/trade/dao/PersistentReport.java index 6945b93077..a537cf4cd4 100644 --- a/trade/trade-server/src/main/java/org/marketcetera/trade/dao/PersistentReport.java +++ b/trade/trade-server/src/main/java/org/marketcetera/trade/dao/PersistentReport.java @@ -123,7 +123,6 @@ public TradeMessage getTradeMessage() * Converts the report into a system report instance. * * @return the system report instance. - * @throws ReportPersistenceException if there were errors converting the message from its persistent representation to system report instance */ public ReportBase toReport() { diff --git a/trade/trade-server/src/main/java/org/marketcetera/trade/event/connector/IncomingTradeMessageBroadcastConnector.java b/trade/trade-server/src/main/java/org/marketcetera/trade/event/connector/IncomingTradeMessageBroadcastConnector.java index 28f02a2f16..08cc7061e3 100644 --- a/trade/trade-server/src/main/java/org/marketcetera/trade/event/connector/IncomingTradeMessageBroadcastConnector.java +++ b/trade/trade-server/src/main/java/org/marketcetera/trade/event/connector/IncomingTradeMessageBroadcastConnector.java @@ -27,7 +27,7 @@ public class IncomingTradeMessageBroadcastConnector /** * Receive the incoming FIX application message. * - * @param inEvent an IncomingFixAppMessageEvent value + * @param inTradeMessage a TradeMessage value */ @Subscribe public void receive(TradeMessage inTradeMessage) diff --git a/trade/trade-server/src/main/java/org/marketcetera/trade/impl/AccountOwnerStrategy.java b/trade/trade-server/src/main/java/org/marketcetera/trade/impl/AccountOwnerStrategy.java index 582942ec96..bd2019c910 100644 --- a/trade/trade-server/src/main/java/org/marketcetera/trade/impl/AccountOwnerStrategy.java +++ b/trade/trade-server/src/main/java/org/marketcetera/trade/impl/AccountOwnerStrategy.java @@ -73,7 +73,7 @@ public AccountUserLookupProvider getAccountUserLookupProvider() /** * Sets the accountUserLookupProvider value. * - * @param an AccountUserLookupProvider value + * @param inAccountUserLookupProvider an AccountUserLookupProvider value */ public void setAccountUserLookupProvider(AccountUserLookupProvider inAccountUserLookupProvider) { diff --git a/trade/trade-server/src/main/java/org/marketcetera/trade/impl/DefaultOwnerStrategy.java b/trade/trade-server/src/main/java/org/marketcetera/trade/impl/DefaultOwnerStrategy.java index 408a59e429..520f052d57 100644 --- a/trade/trade-server/src/main/java/org/marketcetera/trade/impl/DefaultOwnerStrategy.java +++ b/trade/trade-server/src/main/java/org/marketcetera/trade/impl/DefaultOwnerStrategy.java @@ -62,7 +62,7 @@ public String getUsername() /** * Sets the username value. * - * @param a String value + * @param inUsername a String value */ public void setUsername(String inUsername) { @@ -80,7 +80,7 @@ public UserService getUserService() /** * Sets the userService value. * - * @param a UserService value + * @param inUserService a UserService value */ public void setUserService(UserService inUserService) { diff --git a/trade/trade-server/src/main/java/org/marketcetera/trade/impl/OutgoingMessageLookupStrategy.java b/trade/trade-server/src/main/java/org/marketcetera/trade/impl/OutgoingMessageLookupStrategy.java index e4a816bd49..d040da7b66 100644 --- a/trade/trade-server/src/main/java/org/marketcetera/trade/impl/OutgoingMessageLookupStrategy.java +++ b/trade/trade-server/src/main/java/org/marketcetera/trade/impl/OutgoingMessageLookupStrategy.java @@ -107,7 +107,7 @@ public PersistentOutgoingMessageDao getOutgoingMessageDao() /** * Sets the outgoingMessageDao value. * - * @param a PersistentOutgoingMessageDao value + * @param inOutgoingMessageDao a PersistentOutgoingMessageDao value */ public void setOutgoingMessageDao(PersistentOutgoingMessageDao inOutgoingMessageDao) { diff --git a/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/TradePnlServiceImpl.java b/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/TradePnlServiceImpl.java index dcbda65703..95036955bc 100644 --- a/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/TradePnlServiceImpl.java +++ b/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/TradePnlServiceImpl.java @@ -3,18 +3,31 @@ // package org.marketcetera.trade.pnl; +import javax.annotation.PostConstruct; + import org.marketcetera.admin.service.UserService; import org.marketcetera.admin.user.PersistentUser; +import org.marketcetera.core.PlatformServices; import org.marketcetera.core.Preserve; +import org.marketcetera.eventbus.EventBusService; import org.marketcetera.persist.CollectionPageResponse; +import org.marketcetera.trade.Instrument; +import org.marketcetera.trade.UserID; import org.marketcetera.trade.pnl.dao.CurrentPositionDao; import org.marketcetera.trade.pnl.dao.ProfitAndLossDao; import org.marketcetera.trade.pnl.dao.QPersistentCurrentPosition; +import org.marketcetera.trade.pnl.event.PositionChangedEvent; +import org.marketcetera.util.log.SLF4JLoggerProxy; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import com.google.common.eventbus.Subscribe; /* $License$ */ @@ -26,20 +39,21 @@ * @since $Release$ */ @Preserve -@org.springframework.stereotype.Component +@Component public class TradePnlServiceImpl - implements org.marketcetera.trade.pnl.TradePnlService + implements TradePnlService { /** * Requests positions for a user. * - * @param inUserID a org.marketcetera.trade.UserID value - * @param inPageRequest a org.marketcetera.persist.PageRequest value - * @returns a org.marketcetera.trade.pnl.CurrentPosition value + * @param inUserID a UserID value + * @param inPageRequest a PageRequest value + * @return a CollectionPageResponse<CurrentPosition> value */ @Override - @org.springframework.transaction.annotation.Transactional(readOnly=true,propagation=org.springframework.transaction.annotation.Propagation.REQUIRED) - public org.marketcetera.persist.CollectionPageResponse getCurrentPositions(org.marketcetera.trade.UserID inUserID,org.marketcetera.persist.PageRequest inPageRequest) + @Transactional(readOnly=true,propagation=Propagation.REQUIRED) + public CollectionPageResponse getCurrentPositions(UserID inUserID, + org.marketcetera.persist.PageRequest inPageRequest) { Sort sort = Sort.by(new Sort.Order(Sort.Direction.ASC, QPersistentCurrentPosition.persistentCurrentPosition.symbol.getMetadata().getName())); @@ -57,39 +71,45 @@ public org.marketcetera.persist.CollectionPageResponseorg.marketcetera.trade.UserID
value - * @param inInstrument a org.marketcetera.trade.Instrument value - * @param inPageRequest a org.marketcetera.persist.PageRequest value - * @returns a org.marketcetera.trade.pnl.ProfitAndLoss value + * @param inUserID a UserID value + * @param inInstrument a Instrument value + * @param inPageRequest a PageRequest value + * @return a CollectionPageResponse<ProfitAndLoss> value */ @Override - @org.springframework.transaction.annotation.Transactional(readOnly=true,propagation=org.springframework.transaction.annotation.Propagation.REQUIRED) - public org.marketcetera.persist.CollectionPageResponse getProfitAndLoss(org.marketcetera.trade.UserID inUserID,org.marketcetera.trade.Instrument inInstrument,org.marketcetera.persist.PageRequest inPageRequest) + @Transactional(readOnly=true,propagation=Propagation.REQUIRED) + public CollectionPageResponse getProfitAndLoss(UserID inUserID, + Instrument inInstrument, + org.marketcetera.persist.PageRequest inPageRequest) { throw new UnsupportedOperationException(); // TODO } /** * Accept incoming PositionChangedEvent values. + * + * @param inPositionChangedEvent a PositionChangedEvent value */ - @com.google.common.eventbus.Subscribe - public void accept(org.marketcetera.trade.pnl.event.PositionChangedEvent inPositionChangedEvent) + @Subscribe + public void accept(PositionChangedEvent inPositionChangedEvent) { throw new UnsupportedOperationException(); // TODO } /** * Validate and start the object. */ - @javax.annotation.PostConstruct + @PostConstruct public void start() { - org.marketcetera.util.log.SLF4JLoggerProxy.info(this,"Starting {}",org.marketcetera.core.PlatformServices.getServiceName(getClass())); + SLF4JLoggerProxy.info(this, + "Starting {}", + PlatformServices.getServiceName(getClass())); eventBusService.register(this); } /** * provides access to event services */ - @org.springframework.beans.factory.annotation.Autowired - private org.marketcetera.eventbus.EventBusService eventBusService; + @Autowired + private EventBusService eventBusService; /** * provides access to user services */ diff --git a/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/PersistentCurrentPositionFactory.java b/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/PersistentCurrentPositionFactory.java index 4b5eef91f7..43847640f2 100644 --- a/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/PersistentCurrentPositionFactory.java +++ b/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/PersistentCurrentPositionFactory.java @@ -3,6 +3,10 @@ // package org.marketcetera.trade.pnl.dao; +import org.marketcetera.core.Preserve; +import org.marketcetera.trade.pnl.CurrentPosition; +import org.marketcetera.trade.pnl.CurrentPositionFactory; + /* $License$ */ /** @@ -12,28 +16,29 @@ * @version $Id$ * @since $Release$ */ +@Preserve public class PersistentCurrentPositionFactory - implements org.marketcetera.trade.pnl.CurrentPositionFactory + implements CurrentPositionFactory { /** - * Create a new org.marketcetera.trade.pnl.dao.PersistentCurrentPosition instance. + * Create a new PersistentCurrentPosition instance. * - * @return a org.marketcetera.trade.pnl.dao.PersistentCurrentPosition value + * @return a PersistentCurrentPosition value */ @Override - public org.marketcetera.trade.pnl.dao.PersistentCurrentPosition create() + public PersistentCurrentPosition create() { - return new org.marketcetera.trade.pnl.dao.PersistentCurrentPosition(); + return new PersistentCurrentPosition(); } /** - * Create a new org.marketcetera.trade.pnl.dao.PersistentCurrentPosition instance from the given object. + * Create a new PersistentCurrentPosition instance from the given object. * - * @param inObject a org.marketcetera.trade.pnl.dao.PersistentCurrentPosition value - * @return a org.marketcetera.trade.pnl.dao.PersistentCurrentPosition value + * @param inCurrentPosition a CurrentPosition value + * @return a PersistentCurrentPosition value */ @Override - public org.marketcetera.trade.pnl.dao.PersistentCurrentPosition create(org.marketcetera.trade.pnl.CurrentPosition inPersistentCurrentPosition) + public PersistentCurrentPosition create(CurrentPosition inCurrentPosition) { - return new org.marketcetera.trade.pnl.dao.PersistentCurrentPosition(inPersistentCurrentPosition); + return new PersistentCurrentPosition(inCurrentPosition); } } diff --git a/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/PersistentLotFactory.java b/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/PersistentLotFactory.java index 7e97f63251..4cd4d70647 100644 --- a/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/PersistentLotFactory.java +++ b/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/PersistentLotFactory.java @@ -3,6 +3,10 @@ // package org.marketcetera.trade.pnl.dao; +import org.marketcetera.core.Preserve; +import org.marketcetera.trade.pnl.Lot; +import org.marketcetera.trade.pnl.LotFactory; + /* $License$ */ /** @@ -12,28 +16,29 @@ * @version $Id$ * @since $Release$ */ +@Preserve public class PersistentLotFactory - implements org.marketcetera.trade.pnl.LotFactory + implements LotFactory { /** - * Create a new org.marketcetera.trade.pnl.dao.PersistentLot instance. + * Create a new PersistentLot instance. * - * @return a org.marketcetera.trade.pnl.dao.PersistentLot value + * @return a PersistentLot value */ @Override - public org.marketcetera.trade.pnl.dao.PersistentLot create() + public PersistentLot create() { - return new org.marketcetera.trade.pnl.dao.PersistentLot(); + return new PersistentLot(); } /** - * Create a new org.marketcetera.trade.pnl.dao.PersistentLot instance from the given object. + * Create a new PersistentLot instance from the given object. * - * @param inObject a org.marketcetera.trade.pnl.dao.PersistentLot value - * @return a org.marketcetera.trade.pnl.dao.PersistentLot value + * @param inLot a Lot value + * @return a PersistentLot value */ @Override - public org.marketcetera.trade.pnl.dao.PersistentLot create(org.marketcetera.trade.pnl.Lot inPersistentLot) + public PersistentLot create(Lot inLot) { - return new org.marketcetera.trade.pnl.dao.PersistentLot(inPersistentLot); + return new PersistentLot(inLot); } } diff --git a/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/PersistentPositionFactory.java b/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/PersistentPositionFactory.java index b23c7f6386..05c6e28e00 100644 --- a/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/PersistentPositionFactory.java +++ b/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/PersistentPositionFactory.java @@ -3,6 +3,10 @@ // package org.marketcetera.trade.pnl.dao; +import org.marketcetera.core.Preserve; +import org.marketcetera.trade.pnl.Position; +import org.marketcetera.trade.pnl.PositionFactory; + /* $License$ */ /** @@ -12,28 +16,29 @@ * @version $Id$ * @since $Release$ */ +@Preserve public class PersistentPositionFactory - implements org.marketcetera.trade.pnl.PositionFactory + implements PositionFactory { /** - * Create a new org.marketcetera.trade.pnl.dao.PersistentPosition instance. + * Create a new PersistentPosition instance. * - * @return a org.marketcetera.trade.pnl.dao.PersistentPosition value + * @return a PersistentPosition value */ @Override - public org.marketcetera.trade.pnl.dao.PersistentPosition create() + public PersistentPosition create() { - return new org.marketcetera.trade.pnl.dao.PersistentPosition(); + return new PersistentPosition(); } /** - * Create a new org.marketcetera.trade.pnl.dao.PersistentPosition instance from the given object. + * Create a new PersistentPosition instance from the given object. * - * @param inObject a org.marketcetera.trade.pnl.dao.PersistentPosition value - * @return a org.marketcetera.trade.pnl.dao.PersistentPosition value + * @param inPosition a Position value + * @return a PersistentPosition value */ @Override - public org.marketcetera.trade.pnl.dao.PersistentPosition create(org.marketcetera.trade.pnl.Position inPersistentPosition) + public PersistentPosition create(Position inPosition) { - return new org.marketcetera.trade.pnl.dao.PersistentPosition(inPersistentPosition); + return new PersistentPosition(inPosition); } } diff --git a/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/PersistentProfitAndLossFactory.java b/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/PersistentProfitAndLossFactory.java index 9085435489..3a86d74b88 100644 --- a/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/PersistentProfitAndLossFactory.java +++ b/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/PersistentProfitAndLossFactory.java @@ -3,6 +3,10 @@ // package org.marketcetera.trade.pnl.dao; +import org.marketcetera.core.Preserve; +import org.marketcetera.trade.pnl.ProfitAndLoss; +import org.marketcetera.trade.pnl.ProfitAndLossFactory; + /* $License$ */ /** @@ -12,28 +16,29 @@ * @version $Id$ * @since $Release$ */ +@Preserve public class PersistentProfitAndLossFactory - implements org.marketcetera.trade.pnl.ProfitAndLossFactory + implements ProfitAndLossFactory { /** - * Create a new org.marketcetera.trade.pnl.dao.PersistentProfitAndLoss instance. + * Create a new PersistentProfitAndLoss instance. * - * @return a org.marketcetera.trade.pnl.dao.PersistentProfitAndLoss value + * @return a PersistentProfitAndLoss value */ @Override - public org.marketcetera.trade.pnl.dao.PersistentProfitAndLoss create() + public PersistentProfitAndLoss create() { - return new org.marketcetera.trade.pnl.dao.PersistentProfitAndLoss(); + return new PersistentProfitAndLoss(); } /** - * Create a new org.marketcetera.trade.pnl.dao.PersistentProfitAndLoss instance from the given object. + * Create a new PersistentProfitAndLoss instance from the given object. * - * @param inObject a org.marketcetera.trade.pnl.dao.PersistentProfitAndLoss value - * @return a org.marketcetera.trade.pnl.dao.PersistentProfitAndLoss value + * @param inProfitAndLoss a ProfitAndLoss value + * @return a PersistentProfitAndLoss value */ @Override - public org.marketcetera.trade.pnl.dao.PersistentProfitAndLoss create(org.marketcetera.trade.pnl.ProfitAndLoss inPersistentProfitAndLoss) + public PersistentProfitAndLoss create(ProfitAndLoss inProfitAndLoss) { - return new org.marketcetera.trade.pnl.dao.PersistentProfitAndLoss(inPersistentProfitAndLoss); + return new PersistentProfitAndLoss(inProfitAndLoss); } } diff --git a/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/PersistentTradeFactory.java b/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/PersistentTradeFactory.java index e4f9689aae..6a76af1d37 100644 --- a/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/PersistentTradeFactory.java +++ b/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/PersistentTradeFactory.java @@ -3,6 +3,10 @@ // package org.marketcetera.trade.pnl.dao; +import org.marketcetera.core.Preserve; +import org.marketcetera.trade.pnl.Trade; +import org.marketcetera.trade.pnl.TradeFactory; + /* $License$ */ /** @@ -12,28 +16,29 @@ * @version $Id$ * @since $Release$ */ +@Preserve public class PersistentTradeFactory - implements org.marketcetera.trade.pnl.TradeFactory + implements TradeFactory { /** - * Create a new org.marketcetera.trade.pnl.dao.PersistentTrade instance. + * Create a new PersistentTrade instance. * - * @return a org.marketcetera.trade.pnl.dao.PersistentTrade value + * @return a PersistentTrade value */ @Override - public org.marketcetera.trade.pnl.dao.PersistentTrade create() + public PersistentTrade create() { - return new org.marketcetera.trade.pnl.dao.PersistentTrade(); + return new PersistentTrade(); } /** - * Create a new org.marketcetera.trade.pnl.dao.PersistentTrade instance from the given object. + * Create a new PersistentTrade instance from the given object. * - * @param inObject a org.marketcetera.trade.pnl.dao.PersistentTrade value - * @return a org.marketcetera.trade.pnl.dao.PersistentTrade value + * @param inTrade a Trade value + * @return a PersistentTrade value */ @Override - public org.marketcetera.trade.pnl.dao.PersistentTrade create(org.marketcetera.trade.pnl.Trade inPersistentTrade) + public PersistentTrade create(Trade inTrade) { - return new org.marketcetera.trade.pnl.dao.PersistentTrade(inPersistentTrade); + return new PersistentTrade(inTrade); } } diff --git a/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/PersistentUserTrade.java b/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/PersistentUserTrade.java index 6942519fd6..f7d79e61ea 100644 --- a/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/PersistentUserTrade.java +++ b/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/PersistentUserTrade.java @@ -6,7 +6,7 @@ /* $License$ */ /** - * Provides a user-centric view of a {@link Trade}. + * Provides a user-centric view of a {@link org.marketcetera.trade.pnl.UserTrade}. * * @author Colin DuPlantis * @version $Id$ diff --git a/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/PersistentUserTradeFactory.java b/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/PersistentUserTradeFactory.java index 9cc84f6eed..52c5073774 100644 --- a/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/PersistentUserTradeFactory.java +++ b/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/PersistentUserTradeFactory.java @@ -3,6 +3,10 @@ // package org.marketcetera.trade.pnl.dao; +import org.marketcetera.core.Preserve; +import org.marketcetera.trade.pnl.UserTrade; +import org.marketcetera.trade.pnl.UserTradeFactory; + /* $License$ */ /** @@ -12,28 +16,29 @@ * @version $Id$ * @since $Release$ */ +@Preserve public class PersistentUserTradeFactory - implements org.marketcetera.trade.pnl.UserTradeFactory + implements UserTradeFactory { /** - * Create a new org.marketcetera.trade.pnl.dao.PersistentUserTrade instance. + * Create a new PersistentUserTrade instance. * - * @return a org.marketcetera.trade.pnl.dao.PersistentUserTrade value + * @return a PersistentUserTrade value */ @Override - public org.marketcetera.trade.pnl.dao.PersistentUserTrade create() + public PersistentUserTrade create() { - return new org.marketcetera.trade.pnl.dao.PersistentUserTrade(); + return new PersistentUserTrade(); } /** - * Create a new org.marketcetera.trade.pnl.dao.PersistentUserTrade instance from the given object. + * Create a new PersistentUserTrade instance from the given object. * - * @param inObject a org.marketcetera.trade.pnl.dao.PersistentUserTrade value - * @return a org.marketcetera.trade.pnl.dao.PersistentUserTrade value + * @param inUserTrade a UserTrade value + * @return a PersistentUserTrade value */ @Override - public org.marketcetera.trade.pnl.dao.PersistentUserTrade create(org.marketcetera.trade.pnl.UserTrade inPersistentUserTrade) + public PersistentUserTrade create(UserTrade inUserTrade) { - return new org.marketcetera.trade.pnl.dao.PersistentUserTrade(inPersistentUserTrade); + return new PersistentUserTrade(inUserTrade); } } diff --git a/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/UserTradeDao.java b/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/UserTradeDao.java index 8a44860d8e..e28d2ce08f 100644 --- a/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/UserTradeDao.java +++ b/trade/trade-server/src/main/java/org/marketcetera/trade/pnl/dao/UserTradeDao.java @@ -3,16 +3,22 @@ // package org.marketcetera.trade.pnl.dao; +import org.marketcetera.core.Preserve; +import org.marketcetera.trade.pnl.UserTrade; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.querydsl.QuerydslPredicateExecutor; + /* $License$ */ /** - * Provides a user-centric view of a {@link Trade}. + * Providers data store access to {@link UserTrade} objects. * * @author Colin DuPlantis * @version $Id$ * @since $Release$ */ +@Preserve public interface UserTradeDao - extends org.springframework.data.jpa.repository.JpaRepository,org.springframework.data.querydsl.QuerydslPredicateExecutor + extends JpaRepository,QuerydslPredicateExecutor { } diff --git a/trade/trade-server/src/main/java/org/marketcetera/trade/service/impl/MessageOwnerServiceImpl.java b/trade/trade-server/src/main/java/org/marketcetera/trade/service/impl/MessageOwnerServiceImpl.java index 9211e09072..7a9d2b0b78 100644 --- a/trade/trade-server/src/main/java/org/marketcetera/trade/service/impl/MessageOwnerServiceImpl.java +++ b/trade/trade-server/src/main/java/org/marketcetera/trade/service/impl/MessageOwnerServiceImpl.java @@ -183,7 +183,7 @@ public long getOrderCacheSize() /** * Sets the orderCacheSize value. * - * @param a long value + * @param inOrderCacheSize a long value */ public void setOrderCacheSize(long inOrderCacheSize) { @@ -201,7 +201,7 @@ public List getIdentifyOwnerStrategies() /** * Set the identifyOwnerStrategies value. * - * @param a List<IdentifyOwnerStrategy> value + * @param inIdentifyOwnerStrategies a List<IdentifyOwnerStrategy> value */ public void setIdentifyOwnerStrategies(List inIdentifyOwnerStrategies) { diff --git a/trade/trade-server/src/main/java/org/marketcetera/trade/service/impl/ReportServiceImpl.java b/trade/trade-server/src/main/java/org/marketcetera/trade/service/impl/ReportServiceImpl.java index 51a03d58c7..03ea1ea957 100644 --- a/trade/trade-server/src/main/java/org/marketcetera/trade/service/impl/ReportServiceImpl.java +++ b/trade/trade-server/src/main/java/org/marketcetera/trade/service/impl/ReportServiceImpl.java @@ -1130,7 +1130,7 @@ public int getCacheSize() /** * Sets the cacheSize value. * - * @param an int value + * @param inCacheSize an int value */ public void setCacheSize(int inCacheSize) { diff --git a/trade/trade-server/src/main/java/org/marketcetera/trade/service/impl/TradeServiceImpl.java b/trade/trade-server/src/main/java/org/marketcetera/trade/service/impl/TradeServiceImpl.java index 2fca1b9cfc..4c6deaf97a 100644 --- a/trade/trade-server/src/main/java/org/marketcetera/trade/service/impl/TradeServiceImpl.java +++ b/trade/trade-server/src/main/java/org/marketcetera/trade/service/impl/TradeServiceImpl.java @@ -25,6 +25,8 @@ import org.marketcetera.trade.OrderID; import org.marketcetera.trade.Originator; import org.marketcetera.trade.SendOrderFailed; +import org.marketcetera.trade.Suggestion; +import org.marketcetera.trade.SuggestionListener; import org.marketcetera.trade.TradeMessage; import org.marketcetera.trade.TradeMessageBroadcaster; import org.marketcetera.trade.TradeMessageListener; @@ -46,9 +48,6 @@ import com.google.common.collect.Sets; import com.google.common.eventbus.Subscribe; -import quickfix.FieldNotFound; -import quickfix.Message; - /* $License$ */ /** @@ -105,8 +104,8 @@ public ServerFixSession selectServerFixSession(Order inOrder) * @see org.marketcetera.trade.service.TradeService#convertOrder(org.marketcetera.trade.Order, org.marketcetera.brokers.Broker) */ @Override - public Message convertOrder(Order inOrder, - ServerFixSession inServerFixSession) + public quickfix.Message convertOrder(Order inOrder, + ServerFixSession inServerFixSession) { boolean failed = false; String message = null; @@ -143,7 +142,7 @@ public Message convertOrder(Order inOrder, } else if(fixMessage != null && fixMessage.isSetField(quickfix.field.OrderID.FIELD)) { try { orderId = new OrderID(fixMessage.getString(quickfix.field.OrderID.FIELD)); - } catch (FieldNotFound ignored) {} // this exception cannot occur because we explicitly check for the existance of the field above + } catch (quickfix.FieldNotFound ignored) {} // this exception cannot occur because we explicitly check for the existence of the field above } if(orderId == null) { SLF4JLoggerProxy.warn(this, @@ -168,14 +167,14 @@ public Message convertOrder(Order inOrder, public TradeMessage convertResponse(HasFIXMessage inMessage, ServerFixSession inServerFixSession) { - Message fixMessage = inMessage.getMessage(); + quickfix.Message fixMessage = inMessage.getMessage(); try { if(FIXMessageUtil.isTradingSessionStatus(fixMessage)) { Messages.TRADE_SESSION_STATUS.info(this, inServerFixSession.getFIXDataDictionary().getHumanFieldValue(quickfix.field.TradSesStatus.FIELD, fixMessage.getString(quickfix.field.TradSesStatus.FIELD))); } - } catch (FieldNotFound e) { + } catch (quickfix.FieldNotFound e) { PlatformServices.handleException(this, "Unable to process trading session status message", e); @@ -208,7 +207,9 @@ public TradeMessage convertResponse(HasFIXMessage inMessage, @Override public void addTradeMessageListener(TradeMessageListener inTradeMessageListener) { - tradeMessageListeners.add(inTradeMessageListener); + synchronized(tradeMessageListeners) { + tradeMessageListeners.add(inTradeMessageListener); + } } /* (non-Javadoc) * @see org.marketcetera.trade.TradeMessagePublisher#removeTradeMessageListener(org.marketcetera.trade.TradeMessageListener) @@ -216,7 +217,51 @@ public void addTradeMessageListener(TradeMessageListener inTradeMessageListener) @Override public void removeTradeMessageListener(TradeMessageListener inTradeMessageListener) { - tradeMessageListeners.remove(inTradeMessageListener); + synchronized(tradeMessageListeners) { + tradeMessageListeners.remove(inTradeMessageListener); + } + } + /* (non-Javadoc) + * @see org.marketcetera.trade.service.TradeService#addSuggestionListener(org.marketcetera.trade.SuggestionListener) + */ + @Override + public void addSuggestionListener(SuggestionListener inSuggestionListener) + { + synchronized(suggestionListeners) { + suggestionListeners.add(inSuggestionListener); + } + } + /* (non-Javadoc) + * @see org.marketcetera.trade.service.TradeService#removeSuggestionListener(org.marketcetera.trade.SuggestionListener) + */ + @Override + public void removeSuggestionListener(SuggestionListener inSuggestionListener) + { + synchronized(suggestionListeners) { + suggestionListeners.remove(inSuggestionListener); + } + } + /* (non-Javadoc) + * @see org.marketcetera.trade.service.TradeService#reportSuggestion(org.marketcetera.trade.Suggestion) + */ + @Override + public void reportSuggestion(Suggestion inSuggestion) + { + SLF4JLoggerProxy.debug(this, + "Reporting {}", + inSuggestion); + synchronized(suggestionListeners) { + for(SuggestionListener suggestionListener : suggestionListeners) { + try { + suggestionListener.receiveSuggestion(inSuggestion); + } catch (Exception e) { + SLF4JLoggerProxy.warn(this, + e, + "Error broadcasting suggestion, offending listener removed"); + removeSuggestionListener(suggestionListener); + } + } + } } /* (non-Javadoc) * @see org.marketcetera.trade.TradeMessageBroadcaster#reportTradeMessage(org.marketcetera.trade.TradeMessage) @@ -224,14 +269,16 @@ public void removeTradeMessageListener(TradeMessageListener inTradeMessageListen @Override public void reportTradeMessage(TradeMessage inTradeMessage) { - for(TradeMessageListener tradeMessageListener : tradeMessageListeners) { - try { - tradeMessageListener.receiveTradeMessage(inTradeMessage); - } catch (Exception e) { - PlatformServices.handleException(this, - "Error broadcasting trade message", - e); - removeTradeMessageListener(tradeMessageListener); + synchronized(tradeMessageListeners) { + for(TradeMessageListener tradeMessageListener : tradeMessageListeners) { + try { + tradeMessageListener.receiveTradeMessage(inTradeMessage); + } catch (Exception e) { + PlatformServices.handleException(this, + "Error broadcasting trade message, offending listener removed", + e); + removeTradeMessageListener(tradeMessageListener); + } } } } @@ -350,4 +397,8 @@ private ServerFixSession resolveVirtualServerFixSession(ServerFixSession inServe * holds trade message listener subscribers */ private final Set tradeMessageListeners = Sets.newConcurrentHashSet(); + /** + * holds suggestion listener subscribers + */ + private final Set suggestionListeners = Sets.newConcurrentHashSet(); } diff --git a/util-test/.gitignore b/util-test/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/util-test/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/util/.gitignore b/util/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/util/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/util/src/main/java/org/marketcetera/util/except/package.html b/util/src/main/java/org/marketcetera/util/except/package.html index 31eed21c94..c65914b54c 100644 --- a/util/src/main/java/org/marketcetera/util/except/package.html +++ b/util/src/main/java/org/marketcetera/util/except/package.html @@ -69,7 +69,7 @@

General usage

locale-specific string comparison. For example:

-@Test
+@Test
 public void findWorks()
 {
     try {
@@ -145,39 +145,39 @@ 

Thread interruption

    -

  • The exception classes {@link +
  • The exception classes {@link org.marketcetera.util.except.I18NInterruptedException} and {@link org.marketcetera.util.except.I18NInterruptedRuntimeException}, which can be thrown to indicate unsuccessful task completion due to interruption. These are subclasses of {@link org.marketcetera.util.except.I18NException} and {@link org.marketcetera.util.except.I18NRuntimeException} respectively, and -include a default i18n message for interruption.
  • +include a default i18n message for interruption. -

  • The wrapping utilities in {@link +
  • The wrapping utilities in {@link org.marketcetera.util.except.ExceptUtils} use these classes instead of the generic {@link org.marketcetera.util.except.I18NException} and {@link org.marketcetera.util.except.I18NRuntimeException} when the wrapped exception indicates an interruption; these utilities also -ensure that, in such a case, the interrupted flag is set.
  • +ensure that, in such a case, the interrupted flag is set. -

  • The exception swallowing utilities in {@link +
  • The exception swallowing utilities in {@link org.marketcetera.util.except.ExceptUtils} also set the interrupted flag if the exception being swallowed indicates an -interruption.
  • +interruption. -

  • {@link org.marketcetera.util.except.I18NInterruptedException} +
  • {@link org.marketcetera.util.except.I18NInterruptedException} and {@link org.marketcetera.util.except.I18NInterruptedRuntimeException} provide static methods such as {@link org.marketcetera.util.except.I18NInterruptedException#checkInterruption()} -that make it easy for your code to check if interruption has occured +that make it easy for your code to check if interruption has occurred (i.e. the interrupt flag is set) and, if so, throw the exception on -your behalf (while leaving the flag set).
  • +your behalf (while leaving the flag set). -

  • {@link org.marketcetera.util.except.ExceptUtils} provides similar +
  • {@link org.marketcetera.util.except.ExceptUtils} provides similar static methods that throw an {@link -java.lang.InterruptedException} (the flag remains set).
  • +java.lang.InterruptedException} (the flag remains set).
Describes the module attributes
CapabilitiesData Emitter, Data Receiver
Stops data flowsNo
Start OperationNone