Methods Summary |
---|
public java.lang.Object | addToEnvironment(java.lang.String propName, java.lang.Object propVal)
if (myEnv == null) {
myEnv = new Hashtable(5, 0.75f);
}
return myEnv.put(propName, propVal);
|
public void | bind(java.lang.String name, java.lang.Object obj)
if (name.equals("")) {
throw new InvalidNameException("Cannot bind empty name");
}
if (bindings.get(name) != null) {
throw new NameAlreadyBoundException(
"Use rebind to override");
}
bindings.put(name, obj);
store();
|
public void | bind(javax.naming.Name name, java.lang.Object obj)
// Flat namespace; no federation; just call string version
bind(name.toString(), obj);
|
public void | close()
store();
myEnv = null;
bindings = null;
|
public java.lang.String | composeName(java.lang.String name, java.lang.String prefix)
Name result = composeName(new CompositeName(name),
new CompositeName(prefix));
return result.toString();
|
public javax.naming.Name | composeName(javax.naming.Name name, javax.naming.Name prefix)
Name result = (Name)(prefix.clone());
result.addAll(name);
return result;
|
public javax.naming.Context | createSubcontext(java.lang.String name)
throw new OperationNotSupportedException(
"RepositoryContext does not support subcontexts");
|
public javax.naming.Context | createSubcontext(javax.naming.Name name)
// Flat namespace; no federation; just call string version
return createSubcontext(name.toString());
|
public void | destroySubcontext(java.lang.String name)
throw new OperationNotSupportedException(
"RepositoryContext does not support subcontexts");
|
public void | destroySubcontext(javax.naming.Name name)
// Flat namespace; no federation; just call string version
destroySubcontext(name.toString());
|
public java.util.Hashtable | getEnvironment()
if (myEnv == null) {
// Must return non-null
myEnv = new Hashtable(3, 0.75f);
}
return myEnv;
|
static java.lang.String | getFilePath(java.lang.String dirName, java.lang.String filename)
return (String)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
String path = filename + FILE_EXT;
if(path != null) {
// Check if this file exists...
String fname = FileUtil.getAbsolutePath(dirName + path);
File f = new File(fname);
if(!f.exists())
path = DEFAULT_NAME + FILE_EXT;
}
else
path = DEFAULT_NAME + FILE_EXT;
return FileUtil.getAbsolutePath(dirName + path);
}});
|
public java.lang.String | getNameInNamespace()
throw new OperationNotSupportedException("Context.getNameInNamespace() not implemented");
|
public javax.naming.NameParser | getNameParser(java.lang.String name)
return myParser;
|
public javax.naming.NameParser | getNameParser(javax.naming.Name name)
// Flat namespace; no federation; just call string version
return getNameParser(name.toString());
|
public static java.lang.String | getRepositoryName(java.lang.String fname)
String filepath = getFilePath(DEFAULT_NAMETABLE_DIR, fname);
int fileIndex = filepath.lastIndexOf(File.separator);
String filename = null;
if(fileIndex > 0)
filename = filepath.substring(fileIndex + 1);
else
filename = filepath;
int extIndex = filename.lastIndexOf(FILE_EXT);
String fwithoutext;
if(extIndex > 0)
fwithoutext = filename.substring(0, extIndex);
else
fwithoutext = filename;
return fwithoutext;
|
private java.lang.String | getStoragePath()
String dirName = (String) myEnv.get(REPOSITORY_DIR);
if (dirName == null) {
dirName = DEFAULT_NAMETABLE_DIR;
}
// System.out.println("REPOSITORY: " + dirName);
// START OF IASRI 4660742
//_logger.log(Level.FINE,"REPOSITORY: " + dirName);
// END OF IASRI 4660742
return getFilePath(dirName, (String) myEnv.get(REPOSITORY_NAME));
|
public javax.naming.NamingEnumeration | list(java.lang.String name)
if (name.equals("")) {
// listing this context
return new RepNames(bindings.keys());
}
// Perhaps 'name' names a context
Object target = lookup(name);
if (target instanceof Context) {
return ((Context)target).list("");
}
throw new NotContextException(name + " cannot be listed");
|
public javax.naming.NamingEnumeration | list(javax.naming.Name name)
// Flat namespace; no federation; just call string version
return list(name.toString());
|
public javax.naming.NamingEnumeration | listBindings(java.lang.String name)
if (name.equals("")) {
// listing this context
return new RepBindings(bindings.keys());
}
// Perhaps 'name' names a context
Object target = lookup(name);
if (target instanceof Context) {
return ((Context)target).listBindings("");
}
throw new NotContextException(name + " cannot be listed");
|
public javax.naming.NamingEnumeration | listBindings(javax.naming.Name name)
// Flat namespace; no federation; just call string version
return listBindings(name.toString());
|
public java.lang.Object | lookup(java.lang.String name)
if (name.equals("")) {
// Asking to look up this context itself. Create and return
// a new instance with its own independent environment.
return (new RepositoryContext(myEnv));
}
// System.out.println("BINDINGS :" + bindings);
// START OF IASRI 4660742
//_logger.log(Level.FINE,"BINDINGS :" + bindings);
// END OF IASRI 4660742
Object answer = bindings.get(name);
if (answer == null) {
throw new NameNotFoundException(name + " not found");
}
return answer;
|
public java.lang.Object | lookup(javax.naming.Name name)
// Flat namespace; no federation; just call string version
return lookup(name.toString());
|
public java.lang.Object | lookupLink(java.lang.String name)
// This flat context does not treat links specially
return lookup(name);
|
public java.lang.Object | lookupLink(javax.naming.Name name)
// Flat namespace; no federation; just call string version
return lookupLink(name.toString());
|
private static void | print(java.util.Hashtable ht)
for (Enumeration en = ht.keys(); en.hasMoreElements(); ) {
Object key = en.nextElement();
Object value = ht.get(key);
if (debug)
// IASRI 4660742 System.out.println("[" + key + ":" + key.getClass().getName() +
// IASRI 4660742 ", " + value + ":" + value.getClass().getName()
// IASRI 4660742 + "]");
// START OF IASRI 4660742
{
if(_logger.isLoggable(Level.FINE))
_logger.log(Level.FINE,"[" + key + ":" + key.getClass().getName() +", " + value + ":" + value.getClass().getName()+ "]");
}
// END OF IASRI 4660742
}
|
public void | rebind(java.lang.String name, java.lang.Object obj)
if (name.equals("")) {
throw new InvalidNameException("Cannot bind empty name");
}
bindings.put(name, obj);
store();
|
public void | rebind(javax.naming.Name name, java.lang.Object obj)
// Flat namespace; no federation; just call string version
rebind(name.toString(), obj);
|
public java.lang.Object | removeFromEnvironment(java.lang.String propName)
if (myEnv == null)
return null;
return myEnv.remove(propName);
|
public void | rename(java.lang.String oldname, java.lang.String newname)
if (oldname.equals("") || newname.equals("")) {
throw new InvalidNameException("Cannot rename empty name");
}
// Check if new name exists
if (bindings.get(newname) != null) {
throw new NameAlreadyBoundException(newname +
" is already bound");
}
// Check if old name is bound
Object oldBinding = bindings.remove(oldname);
if (oldBinding == null) {
throw new NameNotFoundException(oldname + " not bound");
}
bindings.put(newname, oldBinding);
store();
|
public void | rename(javax.naming.Name oldname, javax.naming.Name newname)
// Flat namespace; no federation; just call string version
rename(oldname.toString(), newname.toString());
|
private void | resurrectTable()
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
bindings = new Properties();
try {
File f = new File(getStoragePath());
if(debug)
// IASRI 4660742 System.out.println("Loaded File: " + f.getAbsolutePath());
// START OF IASRI 4660742
_logger.log(Level.FINE,"Loaded File: " + f.getAbsolutePath());
// END OF IASRI 4660742
if(f.exists())
bindings.load(new FileInputStream(f));
} catch (Exception e) {
// IASRI 4660742 e.printStackTrace();
// START OF IASRI 4660742
_logger.log(Level.SEVERE,"enterprise.load_exception" ,e);
// END OF IASRI 4660742
}
return null;
}});
|
private void | store()
try {
if (bindings != null) {
FileOutputStream fos = new FileOutputStream(getStoragePath());
bindings.store(fos, "Repository resource mapping");
fos.close();
}
} catch (Exception e) {
// IASRI 4660742 e.printStackTrace();
// START OF IASRI 4660742
_logger.log(Level.SEVERE,"enterprise.store_exception" ,e);
// END OF IASRI 4660742
}
|
public void | unbind(javax.naming.Name name)
// Flat namespace; no federation; just call string version
unbind(name.toString());
|
public void | unbind(java.lang.String name)
if (name.equals("")) {
throw new InvalidNameException("Cannot unbind empty name");
}
bindings.remove(name);
store();
|