Skip to content

Commit

Permalink
Reverting main library to .NET 4.5.2
Browse files Browse the repository at this point in the history
Adding NEsper.Core as separate solution
  • Loading branch information
ajaxx committed Oct 13, 2017
1 parent 0b6322b commit 22f0a02
Show file tree
Hide file tree
Showing 4,010 changed files with 449,373 additions and 2,319 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion NEsper.Avro/NEsper.Avro.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NEsper.Avro</RootNamespace>
<AssemblyName>NEsper.Avro</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
Expand Down
25 changes: 25 additions & 0 deletions NEsper.Core/NEsper.Core.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.10
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NEsper.Core", "NEsper.Core\NEsper.Core.csproj", "{20283250-A109-4931-8C63-C86EED410979}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{20283250-A109-4931-8C63-C86EED410979}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{20283250-A109-4931-8C63-C86EED410979}.Debug|Any CPU.Build.0 = Debug|Any CPU
{20283250-A109-4931-8C63-C86EED410979}.Release|Any CPU.ActiveCfg = Release|Any CPU
{20283250-A109-4931-8C63-C86EED410979}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {04C96F91-C4A5-4F50-B78F-5771632D470B}
EndGlobalSection
EndGlobal
20 changes: 20 additions & 0 deletions NEsper.Core/NEsper.Core/NEsper.Core.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<EmbeddedResource Include="client\InitializerTransform.xslt" />
</ItemGroup>

<ItemGroup>
<Folder Include="filter\range\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Antlr4.Runtime.Standard" Version="4.7.1" />
<PackageReference Include="Microsoft.NETCore.Platforms" Version="2.0.0" />
</ItemGroup>

</Project>
39 changes: 39 additions & 0 deletions NEsper.Core/NEsper.Core/adapter/Adapter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
///////////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2006-2017 Esper Team. All rights reserved. /
// http://esper.codehaus.org /
// ---------------------------------------------------------------------------------- /
// The software in this package is published under the terms of the GPL license /
// a copy of which has been included with this distribution in the license.txt file. /
///////////////////////////////////////////////////////////////////////////////////////

using System;

namespace com.espertech.esper.adapter
{
/// <summary>
/// An Adapter takes some external data, converts it into events, and sends
/// it into the runtime engine.
/// </summary>
public interface Adapter : IDisposable
{
/// <summary>Start the sending of events into the runtime egine. </summary>
/// <throws>EPException in case of errors processing the events</throws>
void Start();

/// <summary>Pause the sending of events after a Adapter has been started. </summary>
/// <throws>EPException if this Adapter has already been stopped</throws>
void Pause();

/// <summary>Resume sending events after the Adapter has been paused. </summary>
/// <throws>EPException in case of errors processing the events</throws>
void Resume();

/// <summary>Stop sending events and return the Adapter to the OPENED state, ready to be started once again. </summary>
/// <throws>EPException in case of errors releasing resources</throws>
void Stop();

/// <summary>Get the state of this Adapter. </summary>
/// <returns>state</returns>
AdapterState GetState();
}
}
23 changes: 23 additions & 0 deletions NEsper.Core/NEsper.Core/adapter/AdapterSPI.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
///////////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2006-2017 Esper Team. All rights reserved. /
// http://esper.codehaus.org /
// ---------------------------------------------------------------------------------- /
// The software in this package is published under the terms of the GPL license /
// a copy of which has been included with this distribution in the license.txt file. /
///////////////////////////////////////////////////////////////////////////////////////

using com.espertech.esper.client;

namespace com.espertech.esper.adapter
{
/// <summary>
/// An Adapter takes some external data, converts it into events, and sends it into
/// the runtime engine.
/// </summary>
public interface AdapterSPI
{
/// <summary>Gets or sets the engine instance. </summary>
/// <returns>engine</returns>
EPServiceProvider EPServiceProvider { get; set; }
}
}
26 changes: 26 additions & 0 deletions NEsper.Core/NEsper.Core/adapter/AdapterState.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
///////////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2006-2017 Esper Team. All rights reserved. /
// http://esper.codehaus.org /
// ---------------------------------------------------------------------------------- /
// The software in this package is published under the terms of the GPL license /
// a copy of which has been included with this distribution in the license.txt file. /
///////////////////////////////////////////////////////////////////////////////////////

namespace com.espertech.esper.adapter
{
/// <summary>The state of a Adapter. </summary>
public enum AdapterState
{
/// <summary>Opened state. </summary>
OPENED,

/// <summary>Started state. </summary>
STARTED,

/// <summary>Paused state. </summary>
PAUSED,

/// <summary>Destroyed state. </summary>
DESTROYED
}
}
120 changes: 120 additions & 0 deletions NEsper.Core/NEsper.Core/adapter/AdapterStateManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
///////////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2006-2017 Esper Team. All rights reserved. /
// http://esper.codehaus.org /
// ---------------------------------------------------------------------------------- /
// The software in this package is published under the terms of the GPL license /
// a copy of which has been included with this distribution in the license.txt file. /
///////////////////////////////////////////////////////////////////////////////////////

namespace com.espertech.esper.adapter
{
/// <summary>
/// A utility to manage the state transitions for an InputAdapter.
/// </summary>
public class AdapterStateManager
{
private bool _stateTransitionsAllowed = true;

/// <summary>
/// Initializes a new instance of the <see cref="AdapterStateManager"/> class.
/// </summary>
public AdapterStateManager()
{
State = AdapterState.OPENED;
}

/// <summary>
/// Gets the state.
/// </summary>
/// <returns>the state</returns>
public AdapterState State { get; private set; }

/// <summary>
/// Transition into the STARTED state (from the OPENED state).
/// </summary>
/// <throws>IllegalStateTransitionException if the transition is not allowed</throws>
public void Start()
{
AssertStateTransitionsAllowed();
if(State != AdapterState.OPENED)
{
throw new IllegalStateTransitionException("Cannot start from the " + State + " state");
}
State = AdapterState.STARTED;
}

/// <summary>
/// Transition into the OPENED state.
/// </summary>
/// <throws>IllegalStateTransitionException if the transition isn't allowed</throws>
public void Stop()
{
AssertStateTransitionsAllowed();
if(State != AdapterState.STARTED && State != AdapterState.PAUSED)
{
throw new IllegalStateTransitionException("Cannot stop from the " + State + " state");
}
State = AdapterState.OPENED;
}

/// <summary>
/// Transition into the PAUSED state.
/// </summary>
/// <throws>IllegalStateTransitionException if the transition isn't allowed</throws>
public void Pause()
{
AssertStateTransitionsAllowed();
if(State != AdapterState.STARTED)
{
throw new IllegalStateTransitionException("Cannot pause from the " + State + " state");
}
State = AdapterState.PAUSED;
}

/// <summary>
/// Transition into the STARTED state (from the PAUSED state).
/// </summary>
/// <throws>IllegalStateTransitionException if the state transition is not allowed</throws>
public void Resume()
{
AssertStateTransitionsAllowed();
if(State != AdapterState.PAUSED)
{
throw new IllegalStateTransitionException("Cannot resume from the " + State + " state");
}
State = AdapterState.STARTED;
}

/// <summary>
/// Transition into the DESTROYED state.
/// </summary>
/// <throws>IllegalStateTransitionException if the transition isn't allowed</throws>
public void Dispose()
{
if(State == AdapterState.DESTROYED)
{
throw new IllegalStateTransitionException("Cannot destroy from the " + State + " state");
}
State = AdapterState.DESTROYED;
}

/// <summary>
/// Disallow future state changes, and throw an IllegalStateTransitionException if they are attempted.
/// </summary>
public void DisallowStateTransitions()
{
_stateTransitionsAllowed = false;
}

/// <summary>
/// Asserts the state transitions allowed.
/// </summary>
private void AssertStateTransitionsAllowed()
{
if(!_stateTransitionsAllowed)
{
throw new IllegalStateTransitionException("State transitions have been disallowed");
}
}
}
}
69 changes: 69 additions & 0 deletions NEsper.Core/NEsper.Core/adapter/BaseSubscription.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
///////////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2006-2017 Esper Team. All rights reserved. /
// http://esper.codehaus.org /
// ---------------------------------------------------------------------------------- /
// The software in this package is published under the terms of the GPL license /
// a copy of which has been included with this distribution in the license.txt file. /
///////////////////////////////////////////////////////////////////////////////////////

using System;
using System.Collections.Generic;

using com.espertech.esper.client;
using com.espertech.esper.compat.threading;
using com.espertech.esper.core.context.util;
using com.espertech.esper.core.service;
using com.espertech.esper.core.service.multimatch;
using com.espertech.esper.filter;

namespace com.espertech.esper.adapter
{
/// <summary>
/// Subscription is a concept for selecting events for processing out of all
/// events available from an engine instance.
/// </summary>
public abstract class BaseSubscription : Subscription, FilterHandleCallback
{
/// <summary>The event type of the events we are subscribing for. </summary>
public String EventTypeName { get; set; }

/// <summary>The name of the subscription. </summary>
public String SubscriptionName { get; set; }

public OutputAdapter Adapter { get; private set; }

public abstract int StatementId { get; }

public abstract bool IsSubSelect { get; }

public abstract void MatchFound(EventBean theEvent, ICollection<FilterHandleCallback> allStmtMatches);

/// <summary>Ctor, assigns default name. </summary>
protected BaseSubscription()
{
SubscriptionName = "default";
}

public void RegisterAdapter(OutputAdapter adapter)
{
Adapter = adapter;
RegisterAdapter(((AdapterSPI) adapter).EPServiceProvider);
}

/// <summary>Register an adapter. </summary>
/// <param name="epService">engine</param>
public void RegisterAdapter(EPServiceProvider epService)
{
var spi = (EPServiceProviderSPI) epService;
var eventType = spi.EventAdapterService.GetEventTypeByName(EventTypeName);
var fvs = new FilterSpecCompiled(eventType, null, new IList<FilterSpecParam>[0], null).GetValueSet(null, null, null);

var name = "subscription:" + SubscriptionName;
var metricsHandle = spi.MetricReportingService.GetStatementHandle(-1, name);
var statementHandle = new EPStatementHandle(-1, name, name, StatementType.ESPERIO, name, false, metricsHandle, 0, false, false, spi.ServicesContext.MultiMatchHandlerFactory.GetDefaultHandler());
var agentHandle = new EPStatementAgentInstanceHandle(statementHandle, ReaderWriterLockManager.CreateDefaultLock(), -1, new StatementAgentInstanceFilterVersion(), null);
var registerHandle = new EPStatementHandleCallback(agentHandle, this);
spi.FilterService.Add(fvs, registerHandle);
}
}
}
28 changes: 28 additions & 0 deletions NEsper.Core/NEsper.Core/adapter/IllegalStateTransitionException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
///////////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2006-2017 Esper Team. All rights reserved. /
// http://esper.codehaus.org /
// ---------------------------------------------------------------------------------- /
// The software in this package is published under the terms of the GPL license /
// a copy of which has been included with this distribution in the license.txt file. /
///////////////////////////////////////////////////////////////////////////////////////

using System;

using com.espertech.esper.client;

namespace com.espertech.esper.adapter
{
/// <summary>
/// Thrown when an illegal Adapter state transition is attempted.
/// </summary>
[Serializable]
public class IllegalStateTransitionException : EPException
{
/// <summary />
/// <param name="message">an explanation of the cause of the exception</param>
public IllegalStateTransitionException(String message)
: base(message)
{
}
}
}
25 changes: 25 additions & 0 deletions NEsper.Core/NEsper.Core/adapter/InputAdapter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
///////////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2006-2017 Esper Team. All rights reserved. /
// http://esper.codehaus.org /
// ---------------------------------------------------------------------------------- /
// The software in this package is published under the terms of the GPL license /
// a copy of which has been included with this distribution in the license.txt file. /
///////////////////////////////////////////////////////////////////////////////////////

namespace com.espertech.esper.adapter
{
/// <summary>
/// An InputAdapter takes some external data, converts it into events, and sends it into the runtime engine.
/// </summary>
public interface InputAdapter : Adapter
{
}

public class InputAdapterConstants
{
/// <summary>
/// Use for MapMessage events to indicate the event type name.
/// </summary>
public static readonly string ESPERIO_MAP_EVENT_TYPE = typeof(InputAdapter).FullName + "_maptype";
}
}
Loading

0 comments on commit 22f0a02

Please sign in to comment.