throw new PortAlreadyDefinedException("Port " + portName +
" already defined");
else {
// check if the TypeMap is null
if (properties == null)
throw new NonstandardException("TypeMap should not be empty: " +
"need property portClass");
// add two special properties to typeMap
properties.putString("cca.portName", portName);
properties.putString("cca.portType", type);
// add the classname of the port implementation as a property
properties.putString("cca.portImpl", inPort.getClass().getName());
// extract the class for the interface describing the port
String intfClassName = properties.getString("portClass",
"None");
if (intfClassName.equals("None"))
throw new NonstandardException("TypeMap should contain property " +
"portClass");
// export the provides port as a Grid service
try {
UnicastRemoteObject.exportObject(inPort,
new Class[]{Class.forName(intfClassName)});
} catch (Exception e) {
logger.severe("Can't export the port as a Grid service", e);
throw new NonstandardException("Can't export the port as a Grid service", e);
}
// create an entry for this port in the providesPortMap
if (!(inPort instanceof XCATPort))
throw new NonstandardException("Port to be added not an instance of XCATPort");
// Set the GSH for the provides port
String providesPortHandle = HandleResolver.createGSH(portName);
((XCATPort) inPort).setGSH(providesPortHandle);