tauZaman
v0.1

tauzaman
Class TauZamanService

java.lang.Object
  |
  +--tauzaman.TauZamanService

public class TauZamanService
extends java.lang.Object

TauZamanService class is a wrapper class for TauZamanLocalService and TauZamanRemoteService. It has two rationales;

First, it encapsulates active TauZamanService, which can be either TauZamanLocalService or TauZamanRemoteService. Second, it caches TauZamanService, which is used during creation of a temporal data type, such as Instant, Interval, Period or more fundamentally during creation of a Granule.

There are two kinds of TauZamanServices; TauZamanLocalService and TauZamanRemoteService. The only relation between them can be explained as; TauZamanRemoteService "has a" TauZamanLocalService. Hence, this class keeps two kinds of services seperately in a mutually exclusive manner. That's to say, if one service (remote/local) is null, the other should be valid.

See Also:
TauZamanLocalService, TauZamanRemoteService, Granule, Instant, Interval, Period

Field Summary
private  java.lang.String calendricSystemName
          Cached active CalendricSystem name of valid TauZamanService
private  TauZamanLocalService tzls
          A handle to TauZamanLocalService
private  TauZamanRemoteService tzrs
          A handle to TauZamanRemoteService
 
Constructor Summary
TauZamanService(TauZamanLocalService tzls)
          Constructs a TauZamanService from given TauZamanLocalService.
TauZamanService(TauZamanRemoteService tzrs)
          Constructs a TauZamanService from given TauZamanRemoteService.
 
Method Summary
 void cacheCalendricSystemName()
          Caches CalendricSystem name of valid TauZaman service that this TauZamanService keeps.
 Granularity getActiveCalendricSystemDefaultGranularity()
          Returns default Granularity of active CalendricSystem of this TauZamanService.
 java.lang.String getActiveCalendricSystemName()
          Returns name of active CalendricSystem of this service.
 Granule[] parseInput(java.lang.String input, java.lang.String propertyName)
          Returns an array of Granule objects formed by using input temporal constant and given Property name.
 java.lang.String parseOutput(Granule[] granules, java.lang.String propertyName)
          Converts a timestamp (in terms of Granule(s)) into temporal constant as string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tzls

private TauZamanLocalService tzls
A handle to TauZamanLocalService


tzrs

private TauZamanRemoteService tzrs
A handle to TauZamanRemoteService


calendricSystemName

private java.lang.String calendricSystemName
Cached active CalendricSystem name of valid TauZamanService

Constructor Detail

TauZamanService

public TauZamanService(TauZamanRemoteService tzrs)
                throws TauZamanException
Constructs a TauZamanService from given TauZamanRemoteService.

Parameters:
tzrs - TauZamanRemoteService that this TauZamanService will be initialized
Throws:
TauZamanException - if this service was not set to a valid TauZamanRemoteService

TauZamanService

public TauZamanService(TauZamanLocalService tzls)
                throws TauZamanException
Constructs a TauZamanService from given TauZamanLocalService.

Parameters:
tzls - TauZamanLocalService that this TauZamanService will be initialized
Throws:
TauZamanException - if this service was not set to a valid TauZamanLocalService
Method Detail

cacheCalendricSystemName

public void cacheCalendricSystemName()
                              throws java.rmi.RemoteException
Caches CalendricSystem name of valid TauZaman service that this TauZamanService keeps. This method will be called when a temporal data type needs to cache CalendricSystem name along with active TauZamanService.

Throws:
java.rmi.RemoteException - if any abnormal condition occurs when returning active CalendricSystem name. The only source of exceptions here is Remote connections, if underlying service is Remote.

getActiveCalendricSystemName

public java.lang.String getActiveCalendricSystemName()
                                              throws java.rmi.RemoteException
Returns name of active CalendricSystem of this service.

Returns:
String name of active CalendricSystem of this service
Throws:
java.rmi.RemoteException - if any abnormal condition occurs when returning active CalendricSystem name. The only source of exceptions here is Remote connections, if underlying service is Remote.

getActiveCalendricSystemDefaultGranularity

public Granularity getActiveCalendricSystemDefaultGranularity()
                                                       throws java.rmi.RemoteException
Returns default Granularity of active CalendricSystem of this TauZamanService.

Returns:
default Granularity of active CalendricSystem of this TauZamanService
Throws:
java.rmi.RemoteException - if any abnormal condition occurs when returning active CalendricSystem's default Granularity. The only source of exceptions here is Remote connections, if underlying service is Remote.

parseInput

public Granule[] parseInput(java.lang.String input,
                            java.lang.String propertyName)
                     throws java.rmi.RemoteException,
                            IOException
Returns an array of Granule objects formed by using input temporal constant and given Property name.

Parameters:
input - String that represents input temporal constant
propertyName - name of the Property to be used when parsing input
Returns:
array of Granule objects
Throws:
java.rmi.RemoteException - if any abnormal condition occurs in the connection if this service is remote.
IOException - if any abnormal condition occurs while parsing input temporal constant

parseOutput

public java.lang.String parseOutput(Granule[] granules,
                                    java.lang.String propertyName)
                             throws java.rmi.RemoteException,
                                    IOException
Converts a timestamp (in terms of Granule(s)) into temporal constant as string. Format of the output string, given Property's format template is used.

Parameters:
granules - Calendar parsed timestamp
propertyName - name of the Property, which is used to format of the output string, temporal constant
Returns:
formatted String, which is a temporal constant
Throws:
java.rmi.RemoteException - if any abnormal condition occurs in the connection if this service is remote.
IOException - if any abnormal condition occurs while parsing input temporal constant

tauZaman
v0.1

Submit a bug or feature

tauZaman is an open-source, publicly avaliable project