Class CipDeviceMirror
- 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.CipDevice
-
- com.automation_pros.odva.cip.core.CipDeviceMirror
-
- All Implemented Interfaces:
DataContext,HasGuid
public class CipDeviceMirror extends CipDevice
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 CipDeviceother-
Fields inherited from class com.automation_pros.odva.cip.core.CipDevice
assemblies, guidLock, identity, internalGuid, ports
-
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 CipDeviceMirror(CipDevice other, CipObject parent, java.lang.String reference)CipDeviceMirror(CipDevice other, java.lang.String reference)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.UUIDcurrentGuid()java.util.concurrent.ExecutorServiceexecutor()Services and packet handlers may need to perform extended calculations or communicate with other systems in an unbounded way.CipObjectgetChild(PathSegment seg)Lookup a child for a particular segment.protected CipPathgetEPathImpl()Retrieve the application path that leads to this object starting at the root (no parent).DataContextgetParentDataCtx()Override this at the root of the application tree to supply an application's collection of named and abbreviated types.java.util.UUIDresetGuid()java.util.concurrent.ScheduledExecutorServicescheduler()CIP connections that produce data at intervals need a way to schedule the transmissions, and may need significant time to assemble the data needed.voidservice(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.core.CipDevice
getAssemblyMgr, getConnectionsMgr, getConxMgrMgr, getCxManager, getDevice, getIdentity, getIdentityMgr, getPortMgr, refreshSettings, shutdown
-
Methods inherited from class com.automation_pros.odva.cip.types.CipObject
getDisplayName, getName, getParent, isShutdown, logger, onReplacement, removeChildSymbol, setChild, setChildSymbol, setName, setParent, toString
-
Methods inherited from class com.automation_pros.odva.cip.types.CipTreeCtx
getCtxDataImpl, getNamedDef, 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 CipDevice other
-
-
Method Detail
-
getEPathImpl
protected CipPath getEPathImpl()
Description copied from class:CipTreeRetrieve 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:
getEPathImplin classCipDevice- Returns:
-
getChild
public CipObject getChild(PathSegment seg)
Description copied from class:CipTreeLookup a child for a particular segment.
-
service
public void service(CipObject appContext, CipRequest request, int nesting)
Description copied from class:CipObjectExecute 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:
servicein classCipObject- Parameters:
appContext- Root object for application path lookups. Generally aMirrored Devicefrom 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.
-
getParentDataCtx
public DataContext getParentDataCtx()
Description copied from class:CipTreeCtxOverride this at the root of the application tree to supply an application's collection of named and abbreviated types.- Specified by:
getParentDataCtxin interfaceDataContext- Overrides:
getParentDataCtxin classCipTreeCtx- Returns:
- The containing DataContext, or null if the current context is the root context.
-
executor
public java.util.concurrent.ExecutorService executor()
Description copied from class:CipObjectServices 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:CipObjectCIP 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.
-
resetGuid
public java.util.UUID resetGuid()
-
currentGuid
public java.util.UUID currentGuid()
- Specified by:
currentGuidin interfaceHasGuid- Overrides:
currentGuidin classCipDevice
-
-