📄 remoteproviderimpl.java
字号:
*/
private CallId getProvCall(SerializableCallId id) {
return this.getRefMapper().providerId((SerializableCallId)id);
}
/**
* Get the manager of Serialized References
* Creation date: (2000-02-18 0:08:04)
* @author: Richard Deadman
* @return net.sourceforge.gjtapi.raw.remote.CallMapper
*/
private CallMapper getRefMapper() {
return refMapper;
}
/**
* Delegate on to real TelephonyProvider.
*/
public TermData[] getTerminals() throws RemoteException, ResourceUnavailableException {
TelephonyProvider rp = this.getDelegate();
if (rp != null)
return rp.getTerminals();
else
throw new RemoteException();
}
/**
* Delegate remote getTerminals method to real provider.
*/
public TermData[] getTerminals(String address) throws RemoteException, InvalidArgumentException {
TelephonyProvider rp = this.getDelegate();
if (rp != null)
return rp.getTerminals(address);
else
throw new RemoteException();
}
/**
* Delegate remote hold message to real provider.
*/
public void hold(SerializableCallId call, String address, String term) throws RawStateException, MethodNotSupportedException,
PrivilegeViolationException, ResourceUnavailableException {
this.getDelegate().hold(this.getProvCall(call), address, term);
}
/**
* delegate remote initialize message to real provider.
*/
public void initialize(java.util.Map props) throws ProviderUnavailableException {
this.getDelegate().initialize(props);
}
/**
* Forward the request on to the local RawProvider
*/
public boolean isMediaTerminal(String terminal) {
return this.getDelegate().isMediaTerminal(terminal);
}
/**
* Delegate remote join message to real provider.
*/
public CallId join(SerializableCallId call1, SerializableCallId call2, String address, String terminal) throws RawStateException, InvalidArgumentException, MethodNotSupportedException,
PrivilegeViolationException, ResourceUnavailableException {
return this.getRefMapper().swapId(this.getDelegate().join(this.getProvCall(call1),
this.getProvCall(call2),
address,
terminal));
}
/**
* Forward the request on to the local RawProvider
*/
public void play(String terminal, String[] streamIds, int offset, net.sourceforge.gjtapi.media.RTCHolder[] holders, Dictionary optArgs) throws javax.telephony.media.MediaResourceException {
RTC[] rtcs = new RTC[holders.length];
for (int i = 0; i < holders.length; i++) {
rtcs[i] = holders[i].getRTC();
}
this.getDelegate().play(terminal, streamIds, offset, rtcs, this.fromSerializable(optArgs));
}
/**
* Forward the request on to the local RawProvider
*/
public void record(String terminal,
String streamId,
net.sourceforge.gjtapi.media.RTCHolder[] holders,
Dictionary optArgs) throws javax.telephony.media.MediaResourceException {
RTC[] rtcs = new RTC[holders.length];
for (int i = 0; i < holders.length; i++) {
rtcs[i] = holders[i].getRTC();
}
this.getDelegate().record(terminal, streamId, rtcs, this.fromSerializable(optArgs));
}
/**
* Delegate remote release message to real provider.
*/
public void release(String address, SerializableCallId call) throws PrivilegeViolationException, ResourceUnavailableException, MethodNotSupportedException, RawStateException {
this.getDelegate().release(address, this.getProvCall(call));
// free the reference from my maps
this.getRefMapper().freeId((SerializableCallId)call);
}
/**
* releaseCallId method comment.
*/
public void releaseCallId(SerializableCallId id) throws RemoteException {
this.getDelegate().releaseCallId(this.getProvCall(id));
// now release my handle to it
this.getRefMapper().freeId((SerializableCallId)id);
}
/**
* Delegate removeObserver message to real provider
*/
public void removeListener(RemoteListener rl) {
this.getCallbackMux().removeListener(new RemoteListenerWrapper(rl, this.getRefMapper()));
}
/**
* Forward the request on to the local RawProvider
* <P>Since we don't track which Frameworks monitor a call, only allow turning this on. Note
* that multiple Generic Framework clients may have registered for reporting of this call.
*/
public void reportCallsOnAddress(String address, boolean flag)
throws InvalidArgumentException, ResourceUnavailableException {
if (flag)
this.getDelegate().reportCallsOnAddress(address, flag);
}
/**
* Forward the request on to the local RawProvider
* <P>Since we don't track which Frameworks monitor a call, only allow turning this on. Note
* that multiple Generic Framework clients may have registered for reporting of this call.
*/
public void reportCallsOnTerminal(String terminal, boolean flag)
throws InvalidArgumentException, ResourceUnavailableException {
if (flag)
this.getDelegate().reportCallsOnTerminal(terminal, flag);
}
/**
* Delegate remote reserveCallId message to real provider.
*/
public SerializableCallId reserveCallId(String address) throws RemoteException, InvalidArgumentException {
TelephonyProvider rp = this.getDelegate();
if (rp != null)
return this.getRefMapper().swapId(rp.reserveCallId(address));
else
throw new RemoteException();
}
/**
* Forward the request on to the local RawProvider
*/
public RawSigDetectEvent retrieveSignals(String terminal,
int num,
SymbolHolder[] patHolders,
RTCHolder[] rtcHolders,
Dictionary optArgs) throws MediaResourceException {
RTC[] rtcs = new RTC[rtcHolders.length];
for (int i = 0; i < rtcHolders.length; i++) {
rtcs[i] = rtcHolders[i].getRTC();
}
Symbol[] patterns = new Symbol[patHolders.length];
for (int i = 0; i < patHolders.length; i++) {
patterns[i] = patHolders[i].getSymbol();
}
return this.getDelegate().retrieveSignals(terminal, num, patterns, rtcs, this.fromSerializable(optArgs));
}
/**
* Forward sendPrivateData method to real TPI Provider.
*/
public Serializable sendPrivateData(CallId call, String address, String terminal, Serializable data) throws NotSerializableException, RemoteException {
TelephonyProvider rp = this.getDelegate();
if (rp != null) {
Object o = rp.sendPrivateData(call, address, terminal, data);
if (!(o instanceof Serializable))
throw new NotSerializableException();
return (Serializable)o;
} else
throw new RemoteException();
}
/**
* Forward the request on to the local RawProvider
*/
public void sendSignals(String terminal,
SymbolHolder[] symHolders,
RTCHolder[] rtcHolders,
Dictionary optArgs) throws MediaResourceException {
RTC[] rtcs = new RTC[rtcHolders.length];
for (int i = 0; i < rtcHolders.length; i++) {
rtcs[i] = rtcHolders[i].getRTC();
}
Symbol[] syms = new Symbol[symHolders.length];
for (int i = 0; i < symHolders.length; i++) {
syms[i] = symHolders[i].getSymbol();
}
this.getDelegate().sendSignals(terminal,syms, rtcs, this.fromSerializable(optArgs));
}
/**
* Insert the method's description here.
* Creation date: (2000-02-17 13:24:02)
* @author:
* @param newDelegate net.sourceforge.gjtapi.RawProvider
*/
private void setDelegate(net.sourceforge.gjtapi.TelephonyProvider newDelegate) {
delegate = newDelegate;
}
/**
* setLoadControl method comment.
*/
public void setLoadControl(java.lang.String startAddr, java.lang.String endAddr, double duration, double admissionRate, double interval, int[] treatment) throws java.rmi.RemoteException, javax.telephony.MethodNotSupportedException {
this.getDelegate().setLoadControl(startAddr, endAddr, duration, admissionRate, interval, treatment);
}
/**
* Forward setPrivateData method to real TPI Provider.
*/
public void setPrivateData(CallId call, String address, String terminal, Serializable data) throws RemoteException {
TelephonyProvider rp = this.getDelegate();
if (rp != null)
rp.setPrivateData(call, address, terminal, data);
else
throw new RemoteException();
}
/**
* Eat remote shutdown message -- since more than one client may be connected.
* The provider should handle shutdown from finalize or Unreferenced.
*/
public void shutdown() {}
/**
* Receive a remote stop media request
*/
public void stop(String terminal) {
this.getDelegate().stop(terminal);
}
/**
* Eat request to the local TelephonyProvider
* <P>Since we don't track which Frameworks monitor a call, we should eat this message, even though that will mean
* any call once tracked will always be reported on. Note
* that multiple Generic Framework clients may have registered for reporting of this call.
*/
public boolean stopReportingCall(SerializableCallId call) {
/*TelephonyProvider rp = this.getDelegate();
if (rp != null)
return rp.stopReportingCall(call);
else
throw new RemoteException();
*/
return true;
}
/**
* Describe myself
* @return a string representation of the receiver
*/
public String toString() {
return "RemoteProvider implementation wrapping a RawProvider: " + this.getDelegate();
}
/**
* receive and forware a triggerRTC remote command.
*/
public void triggerRTC(String terminal, SymbolHolder action) {
this.getDelegate().triggerRTC(terminal, action.getSymbol());
}
/**
* Delegate remote unHold message to real provider
*/
public void unHold(SerializableCallId call, String address, String term) throws RawStateException, MethodNotSupportedException,
PrivilegeViolationException, ResourceUnavailableException {
this.getDelegate().unHold(this.getProvCall(call), address, term);
}
/**
* Clean up when the clients are all removed.
*/
public void unreferenced() {
TelephonyProvider rp = this.getDelegate();
if (rp != null) {
rp.removeListener(this.getCallbackMux());
rp.shutdown();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -