⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 corbaprovider.java

📁 jtapi for telephone
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
 * @author: Richard Deadman
 * @return javax.telephony.media.Symbol
 * @param id int
 */
private static Symbol createSymbol(int id) {
	if (id != 0)
		return Symbol.getSymbol(id);
	else
		return null;
}
/**
 * Delegate to remote stub
 */
public boolean freeMedia(java.lang.String terminal, int type) {
	return this.getRemote().freeMedia(terminal, type);
}
/**
 * Get a set or addresses for a remote provider.
 */
public java.lang.String[] getAddresses() throws ResourceUnavailableException {
	try {
		return this.getRemote().getAddresses();
	} catch (ResourceUnavailableEx rue) {
		throw new ResourceUnavailableException(rue.type, rue.reason);
	}
}
/**
 * Return a set of address names from the remote provider.
 */
public String[] getAddresses(String term) throws InvalidArgumentException {
	try {
		return this.getRemote().getAddressesForTerm(term);
	} catch (InvalidArgumentEx iae) {
		throw new InvalidArgumentException(iae.reason);
	}
}
/**
 * getAddressType method comment.
 */
public int getAddressType(java.lang.String name) {
	return this.getRemote().getAddressType(name);
}
/**
 * Ask the raw TelephonyProvider to give a snapshot of the indicated Call.
 * <P>This will only be called on a TelephonyProvider that "trottle"s call events.
 * <P><B>Note:</B> This implies that the given Call will have events delivered on it until such time
 * as a "TelephonyProvider::releaseCallId(CallId)".
 * Creation date: (2000-06-20 15:22:50)
 * @author: Richard Deadman
 * @return net.sourceforge.gjtapi.CallData
 * @param id net.sourceforge.gjtapi.CallId
 */
public net.sourceforge.gjtapi.CallData getCall(CallId id) {
	net.sourceforge.gjtapi.raw.remote.corba.CallData cd = this.getRemote().getCall((int)((SerializableCallId)id).getId());
	return this.toCallData(cd);
}
/**
 * Ask the raw TelephonyProvider to give a snapshot of all Calls on an Address.
 * <P>This will only be called on a TelephonyProvider that "trottle"s call events.
 * <P><B>Note:</B> This implies that the given Call will have events delivered on it until such time
 * as a "TelephonyProvider::releaseCallId(CallId)".
 * Creation date: (2000-06-20 15:22:50)
 * @author: Richard Deadman
 * @return A set of call data.
 * @param number The Address's logical number
 */
public net.sourceforge.gjtapi.CallData[] getCallsOnAddress(String number) {
	return this.convertCallArray(this.getRemote().getCallsOnAddress(number));
}
/**
 * Ask the raw TelephonyProvider to give a snapshot of all Calls at a Terminal.
 * <P>This will only be called on a TelephonyProvider that "trottle"s call events.
 * <P><B>Note:</B> This implies that the given Calls will have events delivered on it until such time
 * as a "TelephonyProvider::releaseCallId(CallId)".
 * Creation date: (2000-06-20 15:22:50)
 * @author: Richard Deadman
 * @return A set of call data.
 * @param term The Terminal's logical name
 */
public net.sourceforge.gjtapi.CallData[] getCallsOnTerminal(String term) {
	return this.convertCallArray(this.getRemote().getCallsOnTerminal(term));
}
/**
 * getCapabilities method comment.
 */
public java.util.Properties getCapabilities() {
	StringEntry[] sEntries = this.getRemote().getCapabilities();
	Properties props = new Properties();
	int size = sEntries.length;
	for (int i = 0; i < size;i++) {
		props.put(sEntries[i].key, sEntries[i].value);
	}
	return props;
}
/**
 * getDialledDigits method comment.
 */
public java.lang.String getDialledDigits(CallId id, String address) {
	return this.getRemote().getDialledDigits((int)((SerializableCallId)id).getId(), address);
}
/**
 * Insert the method's description here.
 * Creation date: (2000-08-24 12:01:45)
 * @author: Richard Deadman
 * @return net.sourceforge.gjtapi.raw.remote.CorbaListener
 */
private CorbaListener getListener() {
	return listener;
}
/**
 * Insert the method's description here.
 * Creation date: (2000-08-24 11:09:53)
 * @author: Richard Deadman
 * @return org.omg.CORBA.ORB
 */
private org.omg.CORBA.ORB getOrb() {
	return orb;
}
/**
 * Call getPrivateData on remote interface.
 */
public Object getPrivateData(CallId call, String address, String terminal) {
	try {
		Any res = this.getRemote().getPrivateData((int)((SerializableCallId)call).getId(), address, terminal);
		return CorbaProvider.convertAny(res);
	} catch (NotSerializableEx nse) {
		throw new PlatformException("sendPrivateData result not serializable through remote proxy");
	}
}
/**
 * Return the CORBA Provider's stub.
 * Creation date: (2000-08-18 14:24:48)
 * @author: Richard Deadman
 * @return The CORBA stub that implements the remote CORBA interface.
 */
private net.sourceforge.gjtapi.raw.remote.corba.CorbaProvider getRemote() {
	return remote;
}
/**
 * Get a list of available terminals.
 * This may be null if the Telephony (raw) Provider does not support Terminals.
 * If the Terminal set it too large, this will throw a ResourceUnavailableException
 * <P>Since we went to lazy connecting between Addresses and Terminals, this is called so
 * we don't have to follow all Address->Terminal associations to get the full set of Terminals.
 * Creation date: (2000-02-11 12:29:00)
 * @author: Richard Deadman
 * @return An array of terminal names, media type containers.
 * @exception ResourceUnavailableException if the set it too large to be returned dynamically.
 */
public net.sourceforge.gjtapi.TermData[] getTerminals() throws ResourceUnavailableException {
	try {
		return this.convertTermDataArray(this.getRemote().getTerminals());
	} catch (ResourceUnavailableEx rue) {
		throw new ResourceUnavailableException(rue.type, rue.reason);
	}
}
/**
 * Return a set of terminal names from the remote provider.
 */
public net.sourceforge.gjtapi.TermData[] getTerminals(String address) throws InvalidArgumentException {
	try {
		return this.convertTermDataArray(this.getRemote().getTerminalsForAddr(address));
	} catch (InvalidArgumentEx iae) {
		throw new InvalidArgumentException(iae.reason);
	}
}
/**
 * Send a hold message for a terminal to a remote provider.
 */
public void hold(CallId call, String address, String terminal) throws RawStateException, MethodNotSupportedException,
	PrivilegeViolationException, ResourceUnavailableException {
	try {
		this.getRemote().hold((int)((SerializableCallId)call).getId(), address, terminal);
	} catch (PrivilegeViolationEx pve) {
		throw new PrivilegeViolationException(pve.type, pve.reason);
	} catch (ResourceUnavailableEx rue) {
		throw new ResourceUnavailableException(rue.type, rue.reason);
	} catch (MethodNotSupportedEx mnse) {
		throw new MethodNotSupportedException(mnse.reason);
	} catch (RawStateEx rse) {
		throw new RawStateException(new SerializableCallId(rse.callId), rse.address, rse.terminal,
			rse.type, rse.state, rse.info);
	}
}
/**
 * Initialize my connection to the remote provider.
 * These properties could be used locally or sent to the server for the creation of a user-session.
 * For now, don't send.
 */
public void initialize(java.util.Map props) throws ProviderUnavailableException {
	// check if required properties are set
	String serviceName = (String)props.get("name");
	if (serviceName == null)
		throw new ProviderUnavailableException(ProviderUnavailableException.CAUSE_INVALID_ARGUMENT,
			"Remote CORBA service name not set: \"name\".");
	String hostName = (String)props.get("server");
	if (hostName == null)
		throw new ProviderUnavailableException(ProviderUnavailableException.CAUSE_INVALID_ARGUMENT,
			"Remote CORBA host name not set: \"server\".");

	// Try to find this server
	try {
		// create and initialize the ORB
		Properties orbProps = new Properties();
		//orbProps.put("org.omg.CORBA.ORBInitialPort", "1050");
		orbProps.put("org.omg.CORBA.ORBInitialHost", hostName);
		ORB orb = ORB.init((String[])null, orbProps);
		this.setOrb(orb);

		// get the root naming context
		org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
		NamingContext ncRef = NamingContextHelper.narrow(objRef);

		// resolve the Object Reference in Naming
		NameComponent nc = new NameComponent(serviceName, "");
		NameComponent path[] = {nc};
		this.setRemote(CorbaProviderHelper.narrow(ncRef.resolve(path)));
	} catch (Exception ex) {
		throw new ProviderUnavailableException(ex.getMessage());
	}
}
/**
 * Delegate to the remote stub
 */
public boolean isMediaTerminal(java.lang.String terminal) {
	return this.getRemote().isMediaTerminal(terminal);
}
/**
 * Tell the remote provider to join two calls
 */
public CallId join(CallId call1, CallId call2, String address, String terminal) throws RawStateException, InvalidArgumentException, MethodNotSupportedException,
	PrivilegeViolationException, ResourceUnavailableException {
	try {
		return new SerializableCallId(this.getRemote().join((int)((SerializableCallId)call1).getId(),
			(int)((SerializableCallId)call2).getId(),
			address,
			terminal));
	} catch (PrivilegeViolationEx pve) {
		throw new PrivilegeViolationException(pve.type, pve.reason);
	} catch (ResourceUnavailableEx rue) {
		throw new ResourceUnavailableException(rue.type, rue.reason);
	} catch (MethodNotSupportedEx mnse) {
		throw new MethodNotSupportedException(mnse.reason);
	} catch (RawStateEx rse) {
		throw new RawStateException(new SerializableCallId(rse.callId), rse.address, rse.terminal,
			rse.type, rse.state, rse.info);
	} catch (InvalidArgumentEx iae) {
		throw new InvalidArgumentException(iae.reason);
	}
}
/**
 * Put RTCs into serializable holder and send to remote stub
 */
public void play(String terminal,
	String[] streamIds,
	int offset,
	RTC[] rtcs,
	Dictionary optArgs) throws javax.telephony.media.MediaResourceException {
	try {
		this.getRemote().play(terminal, streamIds, offset, this.toLongEntryArray(rtcs), this.toLongEntryArray(optArgs));
	} catch (MediaResourceEx mre) {
		throw new MediaResourceException(mre.reason,
			this.createEvent(terminal, mre.event));
	}
}
/**
 * Put RTCs into serializable holder and send to remote stub
 */
public void record(String terminal,
	String streamId,
	RTC[] rtcs,
	Dictionary optArgs) throws javax.telephony.media.MediaResourceException {
	try {
		this.getRemote().record(terminal, streamId, this.toLongEntryArray(rtcs), this.toLongEntryArray(optArgs));
	} catch (MediaResourceEx mre) {
		throw new MediaResourceException(mre.reason,
			this.createEvent(terminal, mre.event));
	}
}
/**
 * Tell the remote provider to release an address from a call.
 */
public void release(String address, CallId call) throws PrivilegeViolationException,
	ResourceUnavailableException, MethodNotSupportedException, RawStateException {
	try {
		this.getRemote().release(address, (int)((SerializableCallId)call).getId());
	} catch (PrivilegeViolationEx pve) {
		throw new PrivilegeViolationException(pve.type, pve.reason);
	} catch (ResourceUnavailableEx rue) {
		throw new ResourceUnavailableException(rue.type, rue.reason);
	} catch (MethodNotSupportedEx mnse) {
		throw new MethodNotSupportedException(mnse.reason);
	} catch (RawStateEx rse) {
		throw new RawStateException(new SerializableCallId(rse.callId), rse.address, rse.terminal,
			rse.type, rse.state, rse.info);
	}
}
/**
 * Release any CallId's that I have reserved.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -