These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Dictionary class.
@TargetsContainer("iiop-client") public static Archive<?> clientDeployment() { String ejbJar = FileUtils.readFile(TransactionIIOPInvocationTestCase.class, "ejb-jar.xml"); final Properties properties = new Properties(); properties.putAll(System.getProperties()); if(properties.containsKey("node1")) { properties.put("node1", NetworkUtils.formatPossibleIpv6Address((String) properties.get("node1"))); } final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "client.jar"); jar.addClasses(ClientEjb.class, IIOPTransactionalHome.class, IIOPTransactionalRemote.class, TransactionIIOPInvocationTestCase.class , IIOPTransactionalStatefulHome.class, IIOPTransactionalStatefulRemote.class) .addAsManifestResource(TransactionIIOPInvocationTestCase.class.getPackage(), "jboss-ejb3.xml", "jboss-ejb3.xml") .addAsManifestResource(new StringAsset(PropertiesValueResolver.replaceProperties(ejbJar, properties)), "ejb-jar.xml"); return jar; }
synchronized boolean put(String pid, Dictionary<String, String> source, boolean rollback) { AtomicLong serialId = getSerialId(pid); // Asign a serialid to the source if we don't already have one String sourceid = source.get(TRANSIENT_PROPERTY_SERIAL_ID); if (sourceid == null) { sourceid = new Long(serialId.incrementAndGet()).toString(); source.put(TRANSIENT_PROPERTY_SERIAL_ID, sourceid); } // Ignore the serialid on rollback if (rollback) { LOGGER.debugf("Config rollback: %s => %s", pid, source); serialId.set(Long.parseLong(sourceid)); configurations.put(pid, source); return true; } // Update if there is no previous config for this pid
* of the managed resource. */ @Override public ObjectName getObjectName(Object managedBean, String beanKey) throws MalformedObjectNameException { String domain = ClassUtils.getPackageName(managedBean.getClass()); Hashtable<String, String> keys = new Hashtable<String, String>(); keys.put(TYPE_KEY, ClassUtils.getShortName(managedBean.getClass())); keys.put(HASH_CODE_KEY, ObjectUtils.getIdentityHexString(managedBean)); return ObjectNameManager.getInstance(domain, keys); } }
Dictionary<String, String> configA = new Hashtable<String, String>(); configA.put("foo", "bar"); Assert.assertTrue(state.put("pidA", configA, false)); Assert.assertEquals("bar", state.get("pidA").get("foo")); Dictionary<String, String> configB = new Hashtable<String, String>(); configB.put("foo", "baz"); Assert.assertTrue(state.put("pidA", configB, false)); Assert.assertEquals("baz", state.get("pidA").get("foo")); Assert.assertFalse(state.put("pidA", configA, false)); Assert.assertEquals("baz", state.get("pidA").get("foo")); } @Test public void testRemoveConfiguration() throws Exception { ConfigAdminState state = new ConfigAdminState(); Dictionary<String, String> configA = new Hashtable<String, String>(); configA.put("foo", "bar");
*/ public void activate(ComponentContext context) { @SuppressWarnings("unchecked") Dictionary<String, Object> properties = context.getProperties(); path = (String) properties.get("path"); rootUri = (String) properties.get("rootUri"); String indexName = (String) properties.get("indexName"); if (indexName != null) this.indexName = indexName; Boolean deeplyAccessible = (Boolean) properties.get("deeplyAccessible"); if (deeplyAccessible != null) this.deeplyAccessible = deeplyAccessible; Boolean modifiable = (Boolean) properties.get("modifiable");
private static final Logger LOG = LoggerFactory.getLogger(FileDataSource.class); @Override public void init(Context context, Properties initProps) { basePath = initProps.getProperty(BASE_PATH); if (initProps.get(URLDataSource.ENCODING) != null) encoding = initProps.getProperty(URLDataSource.ENCODING); } /** * <p> * Returns a reader for the given file. * </p> * <p> * If the given file is not absolute, we try to construct an absolute path * using basePath configuration. If that fails, then the relative path is * tried. If file is not found a RuntimeException is thrown. * </p> * <p>
public void configure(Element metadata, Dictionary configuration) { Element[] meta = metadata.getElements("check", NAMESPACE); if(meta == null) { return; } // Get handler props props.put("instance.name", configuration.get("instance.name")); if(configuration.get("csh.simple") != null) { props.put("Simple", configuration.get("csh.simple")); } if(configuration.get("csh.map") != null) { Dictionary m = (Dictionary) configuration.get("csh.map"); if (m.size() > 0) { props.put("Map1", m.get("a")); props.put("Map2", m.get("b")); props.put("Map3", m.get("c")); } } props.put("changes", new Integer(changes)); } public void initializeComponentFactory(ComponentTypeDescription cd, Element metadata) {
protected static <T> ServiceRegistration<T> registerServiceWithRanking( BundleContext bundleContext, Class<T> clazz, T service, int ranking) { Dictionary<String, Integer> properties = new Hashtable<String, Integer>(); properties.put("service.ranking", ranking); return bundleContext.registerService(clazz, service, properties); } }
context.registerService(Server.class.getName(), server, serverProps); */ //Create a webapp context as a Service and target it at the Server created above WebAppContext webapp = new WebAppContext(); Dictionary props = new Hashtable(); props.put("war","."); props.put("contextPath","/acme"); props.put("managedServerName", serverName); context.registerService(ContextHandler.class.getName(),webapp,props); } /** * Stop the activator. * * @see * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) */ public void stop(BundleContext context) throws Exception {