public final Object childValue(Object parentValue) { Hashtable ht = (Hashtable) parentValue; if(ht != null) { return ht.clone(); } else { return null; } } }
@SuppressWarnings("unchecked") public WrapperInitialContext(final Hashtable<Object,Object> environment) { if (environment != null) { this.environment = (Hashtable<Object,Object>) environment.clone(); } else { this.environment = null; } }
@Override public Hashtable<String, Object> getEnvironment() throws NamingException { return (Hashtable<String, Object>) environment.clone(); }
public Object clone() { return super.clone(); }
public Hashtable<String, Object> getEnvironment() throws NamingException { return (Hashtable<String, Object>)environment.clone(); }
@SuppressWarnings("rawtypes") public Context getInitialContext(Hashtable environment) throws NamingException { return new MemoryContext((Hashtable) environment.clone()) { @Override public Object lookup(String name) throws NamingException { Object toReturn = super.lookup(name); if (toReturn == null) { throw new NamingException("Name not found: " + name); } return toReturn; } @Override public void close() throws NamingException { // simple-jndi will close your context: http://meri-stuff.blogspot.co.uk/2012/01/running-jndi-and-jpa-without-j2ee.html } }; } }
/** * Returns the current environment. * * @return Environment. */ public Hashtable getEnvironment() throws NamingException { if (_env == null) { return new Hashtable(5, 0.75f); } else { return (Hashtable) _env.clone(); } }
@SuppressWarnings("rawtypes") public Context getInitialContext(Hashtable environment) throws NamingException { return new MemoryContext((Hashtable)environment.clone()) { @Override public Object lookup(String name) throws NamingException { Object toReturn = super.lookup(name); if (toReturn == null) { throw new NamingException("Name not found: " + name); } return toReturn; } @Override public void close() throws NamingException { // simple-jndi will close your context: http://meri-stuff.blogspot.co.uk/2012/01/running-jndi-and-jpa-without-j2ee.html } }; } }
public java.lang.Object removeFromEnvironment(String propName) throws NamingException { if (_env != null && _env.get(propName) != null) { // copy-on-write _env = (Hashtable) _env.clone(); return _env.remove(propName); } return null; }
/** Obtain a copy of this thread's MDC prior to serialization or asynchronous logging. */ public void getMDCCopy() { if(mdcCopyLookupRequired) { mdcCopyLookupRequired = false; // the clone call is required for asynchronous logging. // See also bug #5932. Hashtable t = (Hashtable) MDC.getContext(); if(t != null) { mdcCopy = (Hashtable) t.clone(); } } }
/** Obtain a copy of this thread's MDC prior to serialization or asynchronous logging. */ public void getMDCCopy() { if(mdcCopyLookupRequired) { mdcCopyLookupRequired = false; // the clone call is required for asynchronous logging. // See also bug #5932. Hashtable t = (Hashtable) MDC.getContext(); if(t != null) { mdcCopy = (Hashtable) t.clone(); } } }
/** * Adds to the environment for the current context. * Record change but do not reinitialize ORB. * * @param propName The property name. * @param propValue The ORB. * @return the previous value of this property if any. */ public java.lang.Object addToEnvironment(String propName, java.lang.Object propValue) throws NamingException { if (_env == null) { _env = new Hashtable(7, 0.75f); } else { // copy-on-write _env = (Hashtable) _env.clone(); } return _env.put(propName, propValue); }
/** * Copy on write for the internal tables in this context. * * <p>This class is optimized for the normal case where most * elements do not contain Namespace declarations. In that case, * the Context2 will share data structures with its parent. * New tables are obtained only when new declarations are issued, * so they can be popped off the stack.</p> * * <p> JJK: **** Alternative: each Context2 might declare * _only_ its local bindings, and delegate upward if not found.</p> */ private void copyTables () { // Start by copying our parent's bindings prefixTable = (Hashtable)prefixTable.clone(); uriTable = (Hashtable)uriTable.clone(); // Replace the caches with empty ones, rather than // trying to determine which bindings should be flushed. // As far as I can tell, these caches are never actually // used in Xalan... More efficient to remove the whole // cache system? **** if(elementNameTable!=null) elementNameTable=new Hashtable(); if(attributeNameTable!=null) attributeNameTable=new Hashtable(); tablesDirty = true; }
/** * Copy on write for the internal tables in this context. * * <p>This class is optimized for the normal case where most * elements do not contain Namespace declarations.</p> */ private void copyTables () { if (prefixTable != null) { prefixTable = (Hashtable)prefixTable.clone(); } else { prefixTable = new Hashtable(); } if (uriTable != null) { uriTable = (Hashtable)uriTable.clone(); } else { uriTable = new Hashtable(); } elementNameTable = new Hashtable(); attributeNameTable = new Hashtable(); declSeen = true; }
public synchronized Object clone() { return project.getProperties().clone(); }
@Override public void setProperties(Hashtable props) { props = (Hashtable) props.clone(); consumer.setProperties(props); } }
/** * Create a CNCtx object. Gets the initial naming * reference for the COS Naming Service from the ORB. * The ORB can be passed in via the java.naming.corba.orb property * or be created using properties in the environment properties. * * @param env Environment properties for initializing name service. * @throws NamingException Cannot initialize ORB or naming context. */ CNCtx(Hashtable env) throws NamingException { if (env != null) { env = (Hashtable) env.clone(); } _env = env; federation = "true".equals(env != null ? env.get(FED_PROP) : null); initOrbAndRootContext(env); }
@Override public Object lookup(final String name) throws NamingException { try { final int index = name.indexOf('#'); if (index != -1) { final String server = name.substring(0, index); final String lookup = name.substring(index + 1); @SuppressWarnings("unchecked") final Hashtable<Object,Object> environment = (Hashtable<Object,Object>) this.environment.clone(); environment.put(Context.PROVIDER_URL, server); environment.put(ORBConstants.ORB_SERVER_ID_PROPERTY, "1"); return CNCtxFactory.INSTANCE.getInitialContext(environment).lookup(lookup); } else { return CNCtxFactory.INSTANCE.getInitialContext(environment).lookup(name); } } catch (NamingException e) { throw e; } catch (Exception e) { throw new NamingException(e.getMessage()); } }
/** * This method makes a clone of this object. * */ public Object clone() throws CloneNotSupportedException { NamespaceMappings clone = new NamespaceMappings(); clone.m_nodeStack = (NamespaceMappings.Stack) m_nodeStack.clone(); clone.count = this.count; clone.m_namespaces = (Hashtable) m_namespaces.clone(); clone.count = count; return clone; }
/** * This method is used by the iiop and iiopname URL Context factories. */ public static ResolveResult createUsingURL(String url, Hashtable env) throws NamingException { CNCtx ctx = new CNCtx(); if (env != null) { env = (Hashtable) env.clone(); } ctx._env = env; String rest = ctx.initUsingUrl(env != null ? (org.omg.CORBA.ORB) env.get("java.naming.corba.orb") : null, url, env); // rest is the INS name // Return the parsed form to prevent subsequent lookup // from parsing the string as a composite name // The caller should be aware that a toString() of the name // will yield its INS syntax, rather than a composite syntax return new ResolveResult(ctx, parser.parse(rest)); }