
com.sun.tv.si.NetworkImpl Maven / Gradle / Ivy
/*
* @(#)NetworkImpl.java 1.8 00/01/10
*
* Copyright 1998-2000 by Sun Microsystems, Inc.,
* 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
* All rights reserved.
*
* This software is the confidential and proprietary information
* of Sun Microsystems, Inc. ("Confidential Information"). You
* shall not disclose such Confidential Information and shall use
* it only in accordance with the terms of the license agreement
* you entered into with Sun.
*/
package com.sun.tv.si;
import java.util.*;
import com.sun.tv.*;
import com.sun.tv.receiver.*;
import javax.tv.locator.*;
import javax.tv.service.*;
import javax.tv.service.transport.*;
/**
* This interface provides descriptive information about a network of
* transport streams.
*/
public class NetworkImpl implements Network {
private String name = null;
private int networkID = -1;
private Date updatedTime = null;
private Locator locator = null;
private ServiceInformationType siType;
public NetworkImpl(
String name,
int networkID,
ServiceInformationType siType,
Date updatedTime) {
this.name = name;
this.networkID = networkID;
this.siType = siType;
this.updatedTime = updatedTime;
}
/**
* This method returns the ID of this Network
*
* @return A number identifying this network
*/
public int getNetworkID() {
return this.networkID;
}
/**
* This method returns the name of this network.
*
* @return A string representing the name of this network.
*/
public String getName() {
return this.name;
}
/**
* Gets the complete Locator of this SI Element. Each SI Element (such as
* BroadcastService, ProgramEvent, etc.) in the MPEG-2 domain is
* identified by a Locator. This identification is encapsulated by the
* Locator object which may use a URL format, specific MPEG numbers, such
* as network ID, etc., or other mechanisms.
*
* @return Locator representing this SI Element
*/
public Locator getLocator() {
if (this.locator == null) {
try {
this.locator = LocatorFactory.getInstance().createLocator(
LocatorImpl.NetworkProtocol + name);
} catch (Exception e) {
;
}
}
return this.locator;
}
/**
* Returns the time when this object was last updated from data in
* the broadcast.
*
* @return The date of the last update in UTC format, or null
* if unknown.
*/
public Date getUpdateTime() {
return this.updatedTime;
}
/**
* Reports the service information format of this object.
*
* @return The service information format.
*/
public ServiceInformationType getServiceInformationType() {
return this.siType;
}
/**
* Retrieves an array of TransportStream
objects
* representing the transport streams carried in this
* Network
. Only TransportStream
instances
* for which the caller has
* javax.tv.service.ReadPermission
on the underlying
* locator will be present in the array. If this
* Network
does not aggregate transport streams, the
* result is a zero-length array.
*
* This method delivers its results asynchronously.
*
* @param locator A locator referencing a Network
from
* which to retrieve transport stream information.
*
* @param requestor The SIRequestor
to be notified
* when this retrieval operation completes.
*
* @return An SIRequest
object identifying this
* asynchronous retrieval request.
*
* @throws InvalidLocatorException If locator
does not
* reference a valid Network
on the Transport
* implementing this interface.
*
* @throws SecurityException if the caller does not have
* javax.tv.service.ReadPermission(locator)
.
*
* @see TransportStream
* @see javax.tv.service.ReadPermission
*/
public SIRequest retrieveTransportStreams(SIRequestor requestor) {
if ( requestor == null ) {
throw new NullPointerException("SIRequestor null");
}
// TBD check on the array of transport streams.
Locator streamsLocator = LocatorImpl.transformToTransportStream(getLocator());
int reqKind = Settings.REQ_TRANSPORT_STREAM;
return new SIRequestImpl(requestor, streamsLocator, reqKind, this);
}
}