[Requirement #12141] - Ensure the source code repository is managed correctly

Creating Polaris branch.

--HG--
branch : Polaris
[Requirement #12434] - Move operation should be 2.5x faster than Rockstar for a large subtree
[Requirement #12437] - Delete operation should be 2.5x faster than Rockstar for a large subtree
[Requirement #12440] - Copy operation should be 4x faster than Rockstar for a large subtree

Changed this class to use an IList instead of a List. There was no good reason to use a List, and doing so just causes unnecessary copying of the source data into a list (e.g. if the source data is an IList or an array).

--HG--
branch : Polaris
[Requirement #12457] - The time-sharing model should strive for fairness
[Task #12474] - Eliminate polling from work queue processing

 * In order to keep track of changing work items, it proved convenient to add a IUpdateContext.GetAffectedEntities() method, which allows a caller to at any point obtain the set of entity instances that will be affected by the transaction.

--HG--
branch : Polaris
[Requirement #12457] - The time-sharing model should strive for fairness
[Task #12474] - Eliminate polling from work queue processing

Fixed broken Enterprise Server build.  The new IUpdateContext.GetAffectedEntities(...) method needed to be implemented on the Hibernate implementation of IUpdateContext.

--HG--
branch : Polaris
[Requirement #12449] - The set of DICOM attributes that is indexed shall be expanded

Added some helper classes for working with MSMQ to the Enterprise.Core library.

--HG--
branch : Polaris
[Requirement #12449] - The set of DICOM attributes that is indexed shall be expanded

Cleaned up MSMQ helper classes a bit:
 * implemented proper handle management using SafeHandle.
 * added ClearCanvas licensing information to source files.

--HG--
branch : Polaris
[Requirement #12457] - The time-sharing model should strive for fairness

Fixed broken Enterprise Server build - take 2.

--HG--
branch : Polaris
[Requirement #12457] - The time-sharing model should strive for fairness

Fixed broken ImageServer build.

--HG--
branch : Polaris
[Requirement #12457] - The time-sharing model should strive for fairness

Fixed broken ImageServer build - take 2.

--HG--
branch : Polaris
[Requirement #12457] - The time-sharing model should strive for fairness
[Task #12474] - Eliminate polling from work queue processing

Interim commit.
 * In order to reliably reschedule managed work items, it seemed that the prudent thing to do was to set up an implementation of IEntityChangeSetListener that would listen for new or modified WorkItems.
        * Modified LinqToSql.UpdateContext to support publication of entity changesets.
        * Introduced WorkItemSchedulingListener, responsible for observing WorkItem changes and issuing the appropriate scheduling requests.
        * Scheduling requests are routed through the IWorkQueueWakeService (to be renamed), so that it works seamlessly from either the shreds or web process.

 * Because the listener may attempt to schedule a task to run an item that is currently running, the work queue processor needed to be augmented to deal with this.
        * Factored a WorkTaskQueue class out of the ActiveWorkQueueProcessor, to deal with the complexities of determing which tasks are allowed to run at a given time.
        * Attempting to schedule a task with the same ID as a running task causes the prospective task to be "blocked", until the running task is complete.
        * Note that the "SynchronizationKey" mechanism had to be jettisoned: it would have been rather complex to implement well, and it wasn't really being used, so there was little justification for the complexity. Instead, the task ID is now the de facto synchronization key. WorkSources that require synchronization can achieve it by agreeing on the appropriate ID scheme.
        * All of the existing WorkSources were updated so as to generate task IDs that are qualified by the WorkSource ID, to retain the same behaviour as before.

 * Deleted some unused classes.

--HG--
branch : Polaris
[Requirement #12457] - The time-sharing model should strive for fairness
[Task #12474] - Eliminate polling from work queue processing

 * Fixed breakage in Hibernate implementation of UpdateContext.

--HG--
branch : Polaris
[Requirement #12449] - The set of DICOM attributes that is indexed shall be expanded
[Task #12499] - Introduce a global study XML cache

Did some code cleanup on the Dicom.Utilities.Xml.Study/Series/SopInstance classes:

 * Converted tabs to spaces.
 * Implemented resharper suggestions.
 * Re-organized file contents for logical method grouping.
 * Changed implementation of the Study class so that it caches SopClassesInStudy and ModalityInStudy properties, since these could involve non-trivial compute time for large studies (esp. SopClassesInStudy).
 * Renamed HeaderProvider property to DicomFileLoader property, since a) the return type is IDicomFileLoader and b) it seems that it does more than provide headers.

--HG--
branch : Polaris
[Requirement #12449] - The set of DICOM attributes that is indexed shall be expanded
[Task #12499] - Introduce a global study XML cache

Re-designed the IStudy, ISeries, and ISopInstance interfaces a bit in order to make them a little more memory-friendly and suitable for multi-threaded access as is required for a global cache.

 * Removed the IStudy.Series property which was returning an IList<ISeries>.  This could be expensive if there are many series and you don't actually need to materialize the wrappers for all of them (none of the existing use cases did). Replaced this property with:
        * SeriesCount - if you just want to know how many series there are.
        * GetSeries(seriesInstanceUid) - if you know the series you want.
        * FirstSeries - if you just want the first one.
        * EnumerateSeries() - returns an IEnumerable<ISeries>, for cases where you really do need to enumerate all series in the study. Currently not used.

 * Removed the ISeries.SopInstances property which was returning an IList<ISopInstance>.  This could be expensive if there are many SOPs in a series, and you don't actually need to materialize the wrappers for all of them (none of the existing use cases did). Replaced this property with:
        * SopInstanceCount - if you just want to know how many images there are.
        * GetSopInstance(uid) - if you know the image you want.
        * FirstSopInstance - if you just want the first one.
        * EnumerateSopInstances() - returns an IEnumerable<ISopInstance>, for cases where you really do need to enumerate all images in the series. Currently not used.

 * Extracted an IReadOnlyDicomAttribute interface from the DicomAttribute class, because the global cache needs to expose DicomAttribute instances such that they are immutable so that cache users don't inadvertantly modify the contents of the cache.
        * The ISopInstance.GetAttribute(...) methods now return IReadOnlyDicomAttribute instead of DicomAttribute.

--HG--
branch : Polaris
[Requirement #12449] - The set of DICOM attributes that is indexed shall be expanded
[Task #12499] - Introduce a global study XML cache

 * Changed the design of the IStudy, ISeries, and ISopInstance interfaces again in order to factor out the child collections into ISeriesCollection and ISopInstanceCollection objects.
        * Restored the IStudy.Series property, but it now returns ISeriesCollection.
        * Restored the ISeries.SopInstances property, but it now returns ISopInstanceCollection.
        * The IXXCollection interfaces extend IEnumerable<XX> and have the following members:
                * Count
                * Contains(instanceUid)
                * Get(instanceUid) / this[instanceUid]
                * TryGet(instanceUid, out)

--HG--
branch : Polaris
[Requirement #12449] - The set of DICOM attributes that is indexed shall be expanded
[Task #12499] - Introduce a global study XML cache

Added a couple of missing code comments.

--HG--
branch : Polaris
[Requirement #12449] - The set of DICOM attributes that is indexed shall be expanded
[Task #12499] - Introduce a global study XML cache

Made a few small changes to the Study and Series implementations so that, in the event the source StudyXml object has no SeriesXml objects, or a SeriesXml object has no InstanceXml objects, we throw a meaningful error instead of a generic "null reference" or "Sequence contains no elements" error.

--HG--
branch : Polaris
[Requirement #12449] - The set of DICOM attributes that is indexed shall be expanded
[Task #12499] - Introduce a global study XML cache

Added Jetbrains Annotations attribute definitions into the ClearCanvas.Common project, so that we can make use of them and benefit from having Resharper code analysis applied to our own code.  For details, see:

http://blog.jetbrains.com/dotnet/2010/11/17/resharper-nullreferenceexception-analysis-and-its-contracts/

--HG--
branch : Polaris
[Requirement #12449] - The set of DICOM attributes that is indexed shall be expanded
[Task #12498] - Perform indexing in separate workitem

Fixed the PolymorphicDataContractAttribute class constructor so that it generates a more helpful error message if a contract ID has been used more than once.

--HG--
branch : Polaris
[Requirement #12455] - Database size should be ??x smaller than Rockstar for a given dataset
[Task #12496] - Reduce the storage of redundant information at the series and image levels

Added an ISopInstance.StorageInfo property, in order to expose things like FileSize and TransferSyntax from the underlying InstanceXml object.

--HG--
branch : Polaris
[Requirement #12141] - Ensure the source code repository is managed correctly
- Merged default to Polaris, now that default has all but Polaris incorporated (Orion, Rockstar HF2).

--HG--
branch : Polaris