NetKernel APIs


org.ten60.netkernel.layer1.accessor
Class AccessorImpl

java.lang.Object
  extended byorg.ten60.netkernel.layer1.representation.SimpleRepresentationImpl
      extended byorg.ten60.netkernel.layer1.accessor.AccessorImpl
All Implemented Interfaces:
IURAccessor, IURAspect, IURComponent, IURRepresentation, IURRequestee, IURRequestor
Direct Known Subclasses:
AbstractSchemeAccessor, ActiveAccessorImpl, NewSimpleNetAccessor

public abstract class AccessorImpl
extends SimpleRepresentationImpl
implements IURAccessor

Base class for implementing simple accessors. Contains default error handling for child requests to case parent requests to fail. It contains helper methods for requesting and transrepresenting resources


Field Summary
 
Fields inherited from class org.ten60.netkernel.layer1.representation.SimpleRepresentationImpl
mMeta
 
Fields inherited from interface com.ten60.netkernel.urii.accessor.IURAccessor
MIME_TYPE
 
Constructor Summary
AccessorImpl(IURMeta aMeta)
          construct a new AccessorImpl
 
Method Summary
 void destroy()
          destroy the accessor
protected  void finalize()
           
 IURAccessorMeta getAccessorMeta()
          Return the Meta for this accessor
protected  Container getContainer()
          return the container we operating within
protected  ModuleDefinition getModule()
          return the module we reside in
protected  IURRepresentation getResource(URIdentifier aURI, Class aAspectClass, URRequest aOriginalRequest)
          Gets a IURRepresentation for a given URI.
protected  Scheduler getScheduler()
          return the scheduler we can send requests too
 void initialise(Container aContainer, ModuleDefinition aModule)
          initialise the accessor
 void receiveAsyncException(URResult aResult)
          default exception handling is to add exception frame and re-throw
 void receiveAsyncResult(URResult aResult)
          By default we ignore any results we receive- override this if you are making asychronous requests
protected  void sinkResource(URIdentifier aURI, IURRepresentation aRepresentation, URRequest aOriginalRequest)
          Sink a resource to a URI
protected  IURRepresentation transrepresent(URIdentifier aSourceURI, IURRepresentation aSourceRepresentation, Class aTargetClass, URRequest aOriginalRequest)
          Transrepresent an IURRepresentation to another aspect
 
Methods inherited from class org.ten60.netkernel.layer1.representation.SimpleRepresentationImpl
getAspect, getAspects, getMeta, hasAspect
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ten60.netkernel.urrequest.IURRequestee
requestAsync
 
Methods inherited from interface com.ten60.netkernel.urii.IURRepresentation
getAspect, getAspects, getMeta, hasAspect
 

Constructor Detail

AccessorImpl

public AccessorImpl(IURMeta aMeta)
construct a new AccessorImpl

Method Detail

getAccessorMeta

public IURAccessorMeta getAccessorMeta()
Description copied from interface: IURAccessor
Return the Meta for this accessor

Specified by:
getAccessorMeta in interface IURAccessor
Returns:
the accessor meta

initialise

public void initialise(Container aContainer,
                       ModuleDefinition aModule)
                throws NetKernelException
initialise the accessor

Specified by:
initialise in interface IURComponent
Parameters:
aContainer -
aModule -
Throws:
NetKernelException

destroy

public void destroy()
destroy the accessor

Specified by:
destroy in interface IURComponent

receiveAsyncException

public void receiveAsyncException(URResult aResult)
default exception handling is to add exception frame and re-throw

Specified by:
receiveAsyncException in interface IURRequestor
Parameters:
aResult - the exception result of a previous request

receiveAsyncResult

public void receiveAsyncResult(URResult aResult)
By default we ignore any results we receive- override this if you are making asychronous requests

Specified by:
receiveAsyncResult in interface IURRequestor
Parameters:
aResult - the result of a previous request

getModule

protected ModuleDefinition getModule()
return the module we reside in


getContainer

protected Container getContainer()
return the container we operating within


getScheduler

protected Scheduler getScheduler()
return the scheduler we can send requests too


getResource

protected IURRepresentation getResource(URIdentifier aURI,
                                        Class aAspectClass,
                                        URRequest aOriginalRequest)
                                 throws NetKernelException
Gets a IURRepresentation for a given URI. First the parent request is interogated to see if it has been passed by value. If not we go to the scheduler to request it.

Parameters:
aURI - the URI of the resource we want
aAspectClass - the class of an aspect that the representation must exhibit
aOriginalRequest - the original parent request
Returns:
an IURRepresentation containing the requested aspect
Throws:
NetKernelException - thrown the request fails for any reason

transrepresent

protected IURRepresentation transrepresent(URIdentifier aSourceURI,
                                           IURRepresentation aSourceRepresentation,
                                           Class aTargetClass,
                                           URRequest aOriginalRequest)
                                    throws NetKernelException
Transrepresent an IURRepresentation to another aspect

Parameters:
aSourceURI - the URI of aSourceRepresentation
aSourceRepresentation - the representation we want to change aspects on
aTargetClass - the class of aspect we desire
aOriginalRequest - the parent request that invoked this accessor
Returns:
an IURRepresentation with the desired aspect
Throws:
NetKernelException - thrown if the IURRepresentation cannot be transrepresent for any reason

sinkResource

protected void sinkResource(URIdentifier aURI,
                            IURRepresentation aRepresentation,
                            URRequest aOriginalRequest)
                     throws NetKernelException
Sink a resource to a URI

Parameters:
aURI - the URI to sink to
aRepresentation - the representation of the data we want to sink
aOriginalRequest - the parent request that invoked this accessor
Throws:
NetKernelException - thrown if request fails for any reason

finalize

protected void finalize()

NetKernel APIs


Copyright © 2002-2004 1060 Research Ltd. All Rights Reserved.