Class CipObjectMirror
- java.lang.Object
-
- com.automation_pros.odva.cip.types.CipTree
-
- com.automation_pros.odva.cip.types.CipTreeCtx
-
- com.automation_pros.odva.cip.types.CipObject
-
- com.automation_pros.odva.cip.core.CipObjectMirror
-
- All Implemented Interfaces:
DataContext
public class CipObjectMirror extends CipObject
Some CIP objects have context-sensitive implementations. Where such objects only need to substitute a child for service() calls, this object may be used in their place. It will execute services with its own children, but will look up children in the mirrored object when a requested child doesn't exist.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.automation_pros.odva.cip.types.CipObject
CipObject.FutureMultipleReply
-
Nested classes/interfaces inherited from class com.automation_pros.odva.cip.types.CipTree
CipTree.ChildMap
-
-
Field Summary
Fields Modifier and Type Field Description protected CipObject
other
-
Fields inherited from class com.automation_pros.odva.cip.types.CipTree
children, objEPath, parent, segment
-
Fields inherited from interface com.automation_pros.odva.cip.data.DataContext
emptyContext
-
-
Constructor Summary
Constructors Constructor Description CipObjectMirror(CipObject other, CipObject parent, java.lang.String reference)
CipObjectMirror(CipObject other, java.lang.String reference)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.ExecutorService
executor()
Services and packet handlers may need to perform extended calculations or communicate with other systems in an unbounded way.CipObject
getChild(PathSegment seg)
Lookup a child for a particular segment.CipDevice
getDevice()
CipObjects are expected to be organized as a tree, typically with a CipDevice at the root.protected CipPath
getEPathImpl()
Retrieve the application path that leads to this object starting at the root (no parent).java.util.concurrent.ScheduledExecutorService
scheduler()
CIP connections that produce data at intervals need a way to schedule the transmissions, and may need significant time to assemble the data needed.void
service(CipObject appContext, CipRequest request, int nesting)
Execute a CIP service on the object, using the request supplied.-
Methods inherited from class com.automation_pros.odva.cip.types.CipObject
getDisplayName, getName, getParent, isShutdown, logger, onReplacement, removeChildSymbol, setChild, setChildSymbol, setName, setParent, shutdown, toString
-
Methods inherited from class com.automation_pros.odva.cip.types.CipTreeCtx
getCtxDataImpl, getNamedDef, getParentDataCtx, getTypeByCRC, getTypeByName, getTypesImpl
-
Methods inherited from class com.automation_pros.odva.cip.types.CipTree
cleanup, entrySet, follow, getChildren, getEPath, getSegment, keySet, removeChild, setSegment
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.automation_pros.odva.cip.data.DataContext
fromEnum, getCtxData, getCtxDataOrNull, getTypes, makeHosted, makeUnhosted, toEnum
-
-
-
-
Field Detail
-
other
protected final CipObject other
-
-
Method Detail
-
getEPathImpl
protected CipPath getEPathImpl()
Description copied from class:CipTree
Retrieve the application path that leads to this object starting at the root (no parent). Will be called by getEPath() and the result cached by default.Root elements must override this to return an empty CipPath.
- Overrides:
getEPathImpl
in classCipTree
- Returns:
-
getChild
public CipObject getChild(PathSegment seg)
Description copied from class:CipTree
Lookup a child for a particular segment.
-
service
public void service(CipObject appContext, CipRequest request, int nesting)
Description copied from class:CipObject
Execute a CIP service on the object, using the request supplied. Supply a reply to the request and/or throw an appropriate CipException. Replies are not required before this routine returns.
Direct service() calls MUST NOT BLOCK. Any operation that will take any significant time must be delegated to an executor. "Significant" may vary by application, but typically would be in the fractional millisecond range.
- Overrides:
service
in classCipObject
- Parameters:
appContext
- Root object for application path lookups. Generally aMirrored Device
from a port context.request
- What to do and where to reply. Services to be handled by child objects are to be passed to their service() method with nesting+1.nesting
- How many leading path segments items to skip when processing this request. Avoids copying the balance of an application path into a new request when passing a request to a child object.
-
executor
public java.util.concurrent.ExecutorService executor()
Description copied from class:CipObject
Services and packet handlers may need to perform extended calculations or communicate with other systems in an unbounded way. This can be a resource management problem for devices, so the host device must make an appropriate executor service available.The base CIP object implementation simply retrieves the executor from the object's parent, returning a null if there's no parent. This will break real applications, so CipDevice implementations must override this method to supply a real executor.
-
scheduler
public java.util.concurrent.ScheduledExecutorService scheduler()
Description copied from class:CipObject
CIP connections that produce data at intervals need a way to schedule the transmissions, and may need significant time to assemble the data needed. As with executor(), this may be a resource problem for devices, so the host device must make an appropriate scheduler service available. Objects with repetitive housekeeping tasks should also use this scheduler instead of creating their own threads.The base CIP object implementation simply retrieves the scheduler from the object's parent, returning a null if there's no parent. This will break real applications, so CipDevice implementations must override this method to supply a real scheduler.
-
getDevice
public CipDevice getDevice()
Description copied from class:CipObject
CipObjects are expected to be organized as a tree, typically with a CipDevice at the root. (CipDevices can have a parent too, if an implementer chooses to represent a virtual chassis that way.)By default, any CipObject will simply ask its parent for the device if asked for the device. A CipDevice returns itself.
-
-