if (opLogger.loggerI18N.isDebugEnabled())
{
opLogger.loggerI18N.warn( "com.arjuna.orbportability.Services.resolvereffailed", new Object[] { serviceName, e } );
}
throw new InvalidName();
}
}
break;
case NAME_SERVICE:
{
String kind = ((params == null) ? null : (String) params[0]);
try
{
org.omg.CORBA.Object nsRef = _orb.orb().resolve_initial_references(Services.nameService);
NamingContext ncRef = NamingContextHelper.narrow(nsRef);
// bind the Object Reference in Naming
NameComponent nc = new NameComponent(serviceName, kind);
NameComponent path[] = {nc};
objRef = ncRef.resolve(path);
}
catch (SystemException ex)
{
throw ex;
}
catch (UserException e)
{
throw new org.omg.CORBA.ORBPackage.InvalidName();
}
}
break;
case CONFIGURATION_FILE:
{
String cosservicesRoot = opPropertyManager.propertyManager.getProperty(com.arjuna.orbportability.common.Environment.INITIAL_REFERENCES_ROOT);
if (cosservicesRoot == null || cosservicesRoot.length() == 0)
cosservicesRoot = com.arjuna.orbportability.common.Configuration.configFileRoot();
String configLocation = opPropertyManager.propertyManager.getProperty(com.arjuna.orbportability.common.Environment.INITIAL_REFERENCES_FILE,
com.arjuna.orbportability.common.Configuration.configFile());
String configFile = cosservicesRoot+File.separatorChar+configLocation;
LineNumberReader input;
try
{
input = new LineNumberReader(new FileReader(configFile));
}
catch (FileNotFoundException e)
{
if ( opLogger.loggerI18N.isDebugEnabled() )
{
opLogger.loggerI18N.debug( "com.arjuna.orbportability.Services.openfailure", new Object[] { "Services.getService", configFile } );
}
throw new InvalidName();
}
String ior = null;
try
{
boolean finished = false;
while ((ior == null) && !finished)
{
String line = input.readLine();
if (line == null)
finished = true;
else
{
int occur = line.indexOf(serviceName);
if (occur == 0) // should be first on line
ior = line.substring(serviceName.length() +1); // +1 for space separator
}
}
input.close();
}
catch (SystemException ex)
{
input.close();
throw ex;
}
catch (Exception e)
{
if ( opLogger.loggerI18N.isWarnEnabled() )
{
opLogger.loggerI18N.warn( "com.arjuna.orbportability.Services.unexpectedexception",
new Object[] { "Services.getService", e } );
}
input.close();
throw new UNKNOWN();
}
if (ior == null)
{
if ( opLogger.loggerI18N.isWarnEnabled() )
{
opLogger.loggerI18N.warn( "com.arjuna.orbportability.Services.servicenotfound",
new Object[] { serviceName, configFile } );
}
throw new InvalidName();
}
else
{
try
{
objRef = _orb.orb().string_to_object(ior);
}
catch (Exception e)
{
objRef = null;
}
}
}
break;
case FILE:
{
try
{
String fileDir = opPropertyManager.propertyManager.getProperty(com.arjuna.orbportability.common.Environment.FILE_DIR, null);
File f = null;
if (fileDir != null && fileDir.length() != 0)
f = new File(fileDir+File.separator+serviceName);
else
f = new File(serviceName);
FileInputStream ifile = new FileInputStream(f);
int size = (int) f.length();
byte b[] = new byte[size];
ifile.read(b);
ifile.close();
String objString = new String(b);
objRef = _orb.orb().string_to_object(objString);
objString = null;
}
catch (SystemException ex)
{
throw ex;
}
catch (FileNotFoundException e)
{
throw new InvalidName();
}
}
break;
case NAMED_CONNECT:
{