com.plexobject.iploc
Interface IGlobeFacade

All Superinterfaces:
java.rmi.Remote

public interface IGlobeFacade
extends java.rmi.Remote


Field Summary
static java.lang.String[] GMT_TIME_ZONES
           
 
Method Summary
 double calculateTimeZoneDifference(com.plexobject.iploc.Location src, com.plexobject.iploc.Location dst)
          calculateTimeZoneDifference - determines time difference between two time zones
 double calculateTimeZoneDifference(java.lang.String src, java.lang.String dst)
          calculateTimeZoneDifference - determines time difference between two time zones
 java.lang.String currentTimeAtTimeZone(com.plexobject.iploc.Location loc, com.ibm.icu.text.DateFormat df)
          currentTimeAtTimeZone - finds current time at destination zone
 java.lang.String currentTimeAtTimeZone(java.lang.String zone, com.ibm.icu.text.DateFormat df)
          currentTimeAtTimeZone - finds current time at destination zone
 com.plexobject.iploc.Location[] findAirportLocationByCity(java.lang.String city, java.lang.String cc)
          findAirportLocationByCity - finds airport location the given city/country
 com.plexobject.iploc.Location findLocationByCity(java.lang.String city, java.lang.String state, java.lang.String ccOrCountry)
          findLocationByCity - finds location with time-zone, lat/long for the given city/country
 java.lang.String findTimeAtTimeZone(com.plexobject.iploc.Location src, com.plexobject.iploc.Location dst, java.util.Date date, com.ibm.icu.text.DateFormat df)
          findTimeAtTimeZone - finds time at destination zone given the the time at source zone.
 java.lang.String findTimeAtTimeZone(java.lang.String src, java.lang.String dst, java.util.Date date, com.ibm.icu.text.DateFormat df)
          findTimeAtTimeZone - finds time at destination zone given the the time at source zone.
 com.plexobject.iploc.Location[] getAirports()
          getAirports finds all airport locations with their airport codes, time-zones, lat/longs, and other information.
 com.plexobject.iploc.Location[] getAirports(java.lang.String countryCode)
          getAirports finds all airport locations with their airport codes, time-zones, lat/longs, and other information.
 java.lang.String getCanadaStateCode(java.lang.String state)
          getCanadaStateCode finds state-code for the given state-name in Canada
 java.lang.String[] getCanadaStateCodes()
          getCanadaStateCode finds all state-code in Canada
 java.lang.String getCanadaStateName(java.lang.String state)
          getCanadaStateName finds state-name for the given state-code in Canada
 java.lang.String[] getCanadaStateNames()
          getCanadaStateNames finds all state-names in Canada
 com.plexobject.iploc.Location[] getCities(java.lang.String countryCode)
          getCities finds all cities for the given country-code with their time-zones, lat/longs, and other information.
 java.lang.String[] getContinents()
          getContinents - is used by the application programmer to determine list of continents supported by the PlexGlobe library.
 java.lang.String[] getCountries()
          getCountries - finds list of all countries supported by the PlexGlobe library.
 java.lang.String getCountryCode(java.lang.String name)
          getCountryCodes - finds country-code for the given country name
 java.lang.String[] getCountryCodes()
          getCountryCodes - finds list of all country-codes supported by the PlexGlobe library.
 java.lang.String[] getCountryCodesForContinent(java.lang.String continent)
          getCountryCodesForContinent - finds list of all country codes in the given continent
 java.lang.String[][] getCountryCodesWithCountryNames()
          getCountryCodesWithCountryNames - finds list of all country-names along with their country codes supported by the PlexGlobe library.
 java.lang.String getCountryName(java.lang.String cc)
          getCountryName - finds country-name for the given country code
 double getGmtByTimeZone(java.lang.String tz)
          getGmtByTimeZone finds GMT for the time-zone with the given id
 com.plexobject.iploc.Location getLocalTimeZoneLocation()
          getLocalTimeZoneLocation - initializes a virtual location with time-zone set to local time-zone.
 long getNtpCorrection(java.lang.String server)
          getNtpCorrection - returns correction needed to synchronize local time to the external NTP server
 java.lang.String[] getNtpServers()
          getNtpServers - returns list of NTP-servers supported by the PlexGlobe library
 java.lang.String getPhonePrefixForCountryCode(java.lang.String cc)
          getPhonePrefixForCountryCode finds phone prefix for given country-code
 com.ibm.icu.util.TimeZone getTimeZone(java.lang.String id)
          getTimeZone - instantiates time-zone for the given time-zone-id note that PlexGlobe does not use java.util.TimeZone
 com.plexobject.iploc.Location[] getTimeZoneByGmt(float gmt)
          getTimeZoneByGmt finds locations, whose time-zone has same GMT as given gmt.
 java.lang.String[] getTimeZoneIDs()
          getTimeZoneIDs finds time-zone-ids
 java.lang.String[] getTimeZoneIDs(java.lang.String cc)
          getTimeZoneIDs - finds time-zone-ids for given country code
 java.lang.String getUSStateCode(java.lang.String state)
          getUSStateCode finds state-code for the given state-name
 java.lang.String[] getUSStateCodes()
          getUSStateCodes returns list of state-codes in America
 java.lang.String getUSStateName(java.lang.String state)
          getUSStateName finds state-name for the given state-code
 java.lang.String[] getUSStateNames()
          getUSStateNames returns list of state-names in America
 double[] gregorianToJulian(java.util.Date d)
          gregorianToJulian -- converts gregorian date to julian
 java.util.Date julianToGregorian(double jd, double t)
          julianToGregorian -- converts julian to gregorian date
 com.ibm.icu.util.GregorianCalendar newGregorianCalendar()
           
 com.ibm.icu.util.GregorianCalendar newGregorianCalendar(java.util.Locale loc)
           
 boolean supportsTimeZoneID(java.lang.String id)
          supportsTimeZoneID checks if given time-zone is supported by the PlexGlobe library.
 com.plexobject.iploc.Location toZoneLocation(java.lang.String tz)
          toZoneLocation constructs a location that uses time zone based on given zone-id
 

Field Detail

GMT_TIME_ZONES

public static final java.lang.String[] GMT_TIME_ZONES
Method Detail

getLocalTimeZoneLocation

public com.plexobject.iploc.Location getLocalTimeZoneLocation()
                                                       throws java.rmi.RemoteException
getLocalTimeZoneLocation - initializes a virtual location with time-zone set to local time-zone. It will not have any city/state or lat/long info.

Returns:
location for default time-zone on current machine
java.rmi.RemoteException

getContinents

public java.lang.String[] getContinents()
                                 throws java.rmi.RemoteException
getContinents - is used by the application programmer to determine list of continents supported by the PlexGlobe library.

Returns:
returns list of continents supported by the PlexGlobe library.
java.rmi.RemoteException

getCountries

public java.lang.String[] getCountries()
                                throws java.rmi.RemoteException
getCountries - finds list of all countries supported by the PlexGlobe library.

Returns:
returns list of country names supported by the PlexGlobe library.
java.rmi.RemoteException

getCountryCodesForContinent

public java.lang.String[] getCountryCodesForContinent(java.lang.String continent)
                                               throws java.rmi.RemoteException
getCountryCodesForContinent - finds list of all country codes in the given continent

Parameters:
continent - -- name of the continent
Returns:
returns list of country codes in the given continent
java.rmi.RemoteException
See Also:
getContinents()

getCountryCodes

public java.lang.String[] getCountryCodes()
                                   throws java.rmi.RemoteException
getCountryCodes - finds list of all country-codes supported by the PlexGlobe library.

Returns:
returns list of country codes supported by the PlexGlobe library.
java.rmi.RemoteException
See Also:
getCountries()

getCountryCodesWithCountryNames

public java.lang.String[][] getCountryCodesWithCountryNames()
                                                     throws java.rmi.RemoteException
getCountryCodesWithCountryNames - finds list of all country-names along with their country codes supported by the PlexGlobe library.

Returns:
returns array of 2 dimensional array where first dimension stores country-code and second dimension stores country-name, e.g. String[][] ccWithNames = getCountryCodesWithCountryNames(); String firstCode = ccWithNames[0][0]; String firstName = ccWithNames[0][1];
java.rmi.RemoteException
See Also:
getCountries()

getCountryCode

public java.lang.String getCountryCode(java.lang.String name)
                                throws java.rmi.RemoteException
getCountryCodes - finds country-code for the given country name

Parameters:
name - -- name of country
Returns:
country code or null if cannot find the country code
java.rmi.RemoteException
See Also:
getCountries()

getCountryName

public java.lang.String getCountryName(java.lang.String cc)
                                throws java.rmi.RemoteException
getCountryName - finds country-name for the given country code

Parameters:
cc - -- country code
Returns:
country name or null if cannot find the country name
java.rmi.RemoteException
See Also:
getCountries()

getPhonePrefixForCountryCode

public java.lang.String getPhonePrefixForCountryCode(java.lang.String cc)
                                              throws java.rmi.RemoteException
getPhonePrefixForCountryCode finds phone prefix for given country-code

Parameters:
cc - -- country code
Returns:
list of phone prefixes for that country
java.rmi.RemoteException

getCities

public com.plexobject.iploc.Location[] getCities(java.lang.String countryCode)
                                          throws java.io.IOException,
                                                 java.rmi.RemoteException
getCities finds all cities for the given country-code with their time-zones, lat/longs, and other information.

Parameters:
countryCode - - country code to search
Returns:
list of locations that represent cities
java.io.IOException
java.rmi.RemoteException

findLocationByCity

public com.plexobject.iploc.Location findLocationByCity(java.lang.String city,
                                                        java.lang.String state,
                                                        java.lang.String ccOrCountry)
                                                 throws java.io.IOException,
                                                        java.rmi.RemoteException
findLocationByCity - finds location with time-zone, lat/long for the given city/country

Parameters:
city - -- name of the city
state - -- state code
ccOrCountry - -- country code or country-name
Returns:
city location if found otherwise returns null
java.io.IOException
java.rmi.RemoteException

getAirports

public com.plexobject.iploc.Location[] getAirports()
                                            throws java.io.IOException,
                                                   java.rmi.RemoteException
getAirports finds all airport locations with their airport codes, time-zones, lat/longs, and other information.

Returns:
list of locations that represent airports
java.io.IOException
java.rmi.RemoteException

getAirports

public com.plexobject.iploc.Location[] getAirports(java.lang.String countryCode)
                                            throws java.io.IOException,
                                                   java.rmi.RemoteException
getAirports finds all airport locations with their airport codes, time-zones, lat/longs, and other information.

Returns:
list of locations that represent airports
java.io.IOException
java.rmi.RemoteException

findAirportLocationByCity

public com.plexobject.iploc.Location[] findAirportLocationByCity(java.lang.String city,
                                                                 java.lang.String cc)
                                                          throws java.io.IOException,
                                                                 java.rmi.RemoteException
findAirportLocationByCity - finds airport location the given city/country

Parameters:
city - -- name of the city
cc - -- country code
Returns:
list of airport locations
java.io.IOException
java.rmi.RemoteException

getUSStateCodes

public java.lang.String[] getUSStateCodes()
                                   throws java.rmi.RemoteException
getUSStateCodes returns list of state-codes in America

Returns:
list of state-codes
java.rmi.RemoteException

getUSStateNames

public java.lang.String[] getUSStateNames()
                                   throws java.rmi.RemoteException
getUSStateNames returns list of state-names in America

Returns:
list of state-names
java.rmi.RemoteException

getUSStateName

public java.lang.String getUSStateName(java.lang.String state)
                                throws java.rmi.RemoteException
getUSStateName finds state-name for the given state-code

Returns:
state-name if found otherwise null
java.rmi.RemoteException

getUSStateCode

public java.lang.String getUSStateCode(java.lang.String state)
                                throws java.rmi.RemoteException
getUSStateCode finds state-code for the given state-name

Returns:
state-code if found otherwise null
java.rmi.RemoteException

getCanadaStateCodes

public java.lang.String[] getCanadaStateCodes()
                                       throws java.rmi.RemoteException
getCanadaStateCode finds all state-code in Canada

Returns:
list of state-codes
java.rmi.RemoteException

getCanadaStateNames

public java.lang.String[] getCanadaStateNames()
                                       throws java.rmi.RemoteException
getCanadaStateNames finds all state-names in Canada

Returns:
list of state-names
java.rmi.RemoteException

getCanadaStateName

public java.lang.String getCanadaStateName(java.lang.String state)
                                    throws java.rmi.RemoteException
getCanadaStateName finds state-name for the given state-code in Canada

Returns:
state-name if found otherwise null
java.rmi.RemoteException

getCanadaStateCode

public java.lang.String getCanadaStateCode(java.lang.String state)
                                    throws java.rmi.RemoteException
getCanadaStateCode finds state-code for the given state-name in Canada

Returns:
state-code if found otherwise null
java.rmi.RemoteException

newGregorianCalendar

public com.ibm.icu.util.GregorianCalendar newGregorianCalendar()
                                                        throws java.rmi.RemoteException
Returns:
instantiates a new gregorian calendar. Note that PlexGlobe does not use java.util.Calendar class
java.rmi.RemoteException

newGregorianCalendar

public com.ibm.icu.util.GregorianCalendar newGregorianCalendar(java.util.Locale loc)
                                                        throws java.rmi.RemoteException
Parameters:
loc - -- locale
Returns:
instantiates a new gregorian calendar. Note that PlexGlobe does not use java.util.Calendar class
java.rmi.RemoteException

getTimeZoneIDs

public java.lang.String[] getTimeZoneIDs()
                                  throws java.rmi.RemoteException
getTimeZoneIDs finds time-zone-ids

Returns:
list of major time-zone-ids
java.rmi.RemoteException

toZoneLocation

public com.plexobject.iploc.Location toZoneLocation(java.lang.String tz)
                                             throws java.io.IOException,
                                                    java.rmi.RemoteException
toZoneLocation constructs a location that uses time zone based on given zone-id

Parameters:
tz - - time-zone-id
Returns:
location
java.io.IOException
java.rmi.RemoteException

getTimeZoneIDs

public java.lang.String[] getTimeZoneIDs(java.lang.String cc)
                                  throws java.io.IOException,
                                         java.rmi.RemoteException
getTimeZoneIDs - finds time-zone-ids for given country code

Parameters:
cc - -- country code
Returns:
array of time-zone-ids
java.io.IOException
java.rmi.RemoteException

supportsTimeZoneID

public boolean supportsTimeZoneID(java.lang.String id)
                           throws java.rmi.RemoteException
supportsTimeZoneID checks if given time-zone is supported by the PlexGlobe library.

Parameters:
id - -- time-zone id
Returns:
true if time-zone-id is supported otherwise false
java.rmi.RemoteException

getTimeZoneByGmt

public com.plexobject.iploc.Location[] getTimeZoneByGmt(float gmt)
                                                 throws java.io.IOException,
                                                        java.rmi.RemoteException
getTimeZoneByGmt finds locations, whose time-zone has same GMT as given gmt.

Parameters:
gmt - -- GMT offset
Returns:
list of locations with their time-zone, city/states, lat/longs
java.io.IOException
java.rmi.RemoteException

getGmtByTimeZone

public double getGmtByTimeZone(java.lang.String tz)
                        throws java.io.IOException,
                               java.rmi.RemoteException
getGmtByTimeZone finds GMT for the time-zone with the given id

Parameters:
tz - time-zone-id
Returns:
gmt -- GMT offset
java.io.IOException
java.rmi.RemoteException

getTimeZone

public com.ibm.icu.util.TimeZone getTimeZone(java.lang.String id)
                                      throws java.rmi.RemoteException
getTimeZone - instantiates time-zone for the given time-zone-id note that PlexGlobe does not use java.util.TimeZone

Parameters:
id - time-zone-id
Returns:
time-zone
java.rmi.RemoteException

currentTimeAtTimeZone

public java.lang.String currentTimeAtTimeZone(com.plexobject.iploc.Location loc,
                                              com.ibm.icu.text.DateFormat df)
                                       throws java.io.IOException,
                                              java.rmi.RemoteException
currentTimeAtTimeZone - finds current time at destination zone

Parameters:
loc - -- target location
df - -- date format -- if null default date format is used
Returns:
returns current time at the destination time zone
java.io.IOException
java.rmi.RemoteException

currentTimeAtTimeZone

public java.lang.String currentTimeAtTimeZone(java.lang.String zone,
                                              com.ibm.icu.text.DateFormat df)
                                       throws java.io.IOException,
                                              java.rmi.RemoteException
currentTimeAtTimeZone - finds current time at destination zone

Parameters:
zone - -- target time-zone
df - -- date format -- if null default date format is used
Returns:
returns current time at the destination time zone
java.io.IOException
java.rmi.RemoteException

findTimeAtTimeZone

public java.lang.String findTimeAtTimeZone(com.plexobject.iploc.Location src,
                                           com.plexobject.iploc.Location dst,
                                           java.util.Date date,
                                           com.ibm.icu.text.DateFormat df)
                                    throws java.io.IOException,
                                           java.rmi.RemoteException
findTimeAtTimeZone - finds time at destination zone given the the time at source zone. User can use this to find out time at zone2 if time is specified at zone1. For example, if it is July 2, 2003 4:30pm in New York, user can ask what would be time at London, England.

Parameters:
src - -- source location if null, local time zone is used
dst - -- target location
date - -- time at the source location If null, current time is used.
df - -- date format -- if null default date format is used
Returns:
time at the destination time zone
java.io.IOException
java.rmi.RemoteException

findTimeAtTimeZone

public java.lang.String findTimeAtTimeZone(java.lang.String src,
                                           java.lang.String dst,
                                           java.util.Date date,
                                           com.ibm.icu.text.DateFormat df)
                                    throws java.io.IOException,
                                           java.rmi.RemoteException
findTimeAtTimeZone - finds time at destination zone given the the time at source zone. User can use this to find out time at zone2 if time is specified at zone1. For example, if it is July 2, 2003 4:30pm in New York, user can ask what would be time at London, England.

Parameters:
src - -- source time zone if null, local time zone is used
dst - -- target time zone
date - -- time at the source time zone. If null, current time is used.
df - -- date format -- if null default date format is used
Returns:
time at the destination time zone
java.io.IOException
java.rmi.RemoteException

calculateTimeZoneDifference

public double calculateTimeZoneDifference(com.plexobject.iploc.Location src,
                                          com.plexobject.iploc.Location dst)
                                   throws java.io.IOException,
                                          java.rmi.RemoteException
calculateTimeZoneDifference - determines time difference between two time zones

Parameters:
src - -- source location for time-zone
dst - -- target location for time-zone
Returns:
time at the destination time zone
java.io.IOException
java.rmi.RemoteException

calculateTimeZoneDifference

public double calculateTimeZoneDifference(java.lang.String src,
                                          java.lang.String dst)
                                   throws java.io.IOException,
                                          java.rmi.RemoteException
calculateTimeZoneDifference - determines time difference between two time zones

Parameters:
src - -- source location for time-zone
dst - -- target location for time-zone
Returns:
time at the destination time zone
java.io.IOException
java.rmi.RemoteException

gregorianToJulian

public double[] gregorianToJulian(java.util.Date d)
                           throws java.io.IOException,
                                  java.rmi.RemoteException
gregorianToJulian -- converts gregorian date to julian

Returns:
double array of doubles where first index stores julian date and second index stores julian century, e.g. double[] d = gregorianToJulian(new Date()); double julianDate = d[0]; double julianCentury = d[1];
java.io.IOException
java.rmi.RemoteException

julianToGregorian

public java.util.Date julianToGregorian(double jd,
                                        double t)
                                 throws java.io.IOException,
                                        java.rmi.RemoteException
julianToGregorian -- converts julian to gregorian date

Parameters:
jd - - julian date
t - - julian century
Returns:
gregorian date
java.io.IOException
java.rmi.RemoteException

getNtpServers

public java.lang.String[] getNtpServers()
                                 throws java.rmi.RemoteException
getNtpServers - returns list of NTP-servers supported by the PlexGlobe library

Returns:
list of NTP-servers
java.rmi.RemoteException

getNtpCorrection

public long getNtpCorrection(java.lang.String server)
                      throws java.io.IOException,
                             java.rmi.RemoteException
getNtpCorrection - returns correction needed to synchronize local time to the external NTP server

Returns:
correction amount, the clock should be to current time + correction, e.g. long correction = getNtpCorrection(getNtpServers()[0]); long time = System.currentTimeMillis() + correction;
java.io.IOException
java.rmi.RemoteException