Class CipClassMirror
- 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.CipClass
-
- com.automation_pros.odva.cip.core.CipClassMirror
-
- All Implemented Interfaces:
DataContext,AttributeHolder,InstanceHolder
public class CipClassMirror extends CipClass
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 that 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
-
Nested classes/interfaces inherited from interface com.automation_pros.odva.cip.types.InstanceHolder
InstanceHolder.InstanceHolderDelegate, InstanceHolder.MaxInstData, InstanceHolder.NumInstData
-
-
Field Summary
Fields Modifier and Type Field Description protected CipClassother-
Fields inherited from class com.automation_pros.odva.cip.core.CipClass
attr_all, classCode, delegate, mxclsattr, mxinstattr, revision
-
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 CipClassMirror(CipClass other, CipDevice parent, java.lang.String reference)CipClassMirror(CipClass other, java.lang.String reference)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.CipDevicegetDevice()CipObjects are expected to be organized as a tree, typically with a CipDevice at the root.protected CipPathgetEPathImpl()Retrieve the application path that leads to this object starting at the root (no parent).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.CipClass
getAttribute, getAutoInstanceNumber, getInstance, getInstances, getMaxInstance, getNumInstances, getRevision, getSegment, 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, getParentDataCtx, getTypeByCRC, getTypeByName, getTypesImpl
-
Methods inherited from class com.automation_pros.odva.cip.types.CipTree
cleanup, entrySet, follow, getChildren, getEPath, 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.types.AttributeHolder
getDisplayName, getEPath, getParent, isShutdown, logger
-
Methods inherited from interface com.automation_pros.odva.cip.data.DataContext
fromEnum, getCtxData, getCtxDataOrNull, getTypes, makeHosted, makeUnhosted, toEnum
-
-
-
-
Field Detail
-
other
protected final CipClass 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 classCipClass- Returns:
-
getChild
public CipObject getChild(PathSegment seg)
Description copied from class:CipTreeLookup a child for a particular segment.- Specified by:
getChildin interfaceAttributeHolder- Overrides:
getChildin classCipObject
-
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.
- Specified by:
servicein interfaceAttributeHolder- Overrides:
servicein classCipClass- 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.
-
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.
- Specified by:
executorin interfaceAttributeHolder- Overrides:
executorin classCipObject- Returns:
- An executor for general immediate task processing.
-
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.
- Specified by:
schedulerin interfaceAttributeHolder- Overrides:
schedulerin classCipObject- Returns:
- An executor for repeating task processing.
-
getDevice
public CipDevice getDevice()
Description copied from class:CipObjectCipObjects 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.
-
-