Class 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.
    • Field Detail

    • Constructor Detail

      • CipClassMirror

        public CipClassMirror​(CipClass other,
                              java.lang.String reference)
      • CipClassMirror

        public CipClassMirror​(CipClass other,
                              CipDevice parent,
                              java.lang.String reference)
    • 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 class CipClass
        Returns:
      • 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.

        Specified by:
        service in interface AttributeHolder
        Overrides:
        service in class CipClass
        Parameters:
        appContext - Root object for application path lookups. Generally a Mirrored 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.

        Specified by:
        executor in interface AttributeHolder
        Overrides:
        executor in class CipObject
        Returns:
        An executor for general immediate task processing.
      • 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.

        Specified by:
        scheduler in interface AttributeHolder
        Overrides:
        scheduler in class CipObject
        Returns:
        An executor for repeating task processing.
      • 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.

        Overrides:
        getDevice in class CipObject
        Returns:
        The CipDevice found in the parents of this object, if any.