Example usage for java.util Dictionary put

List of usage examples for java.util Dictionary put

Introduction

In this page you can find the example usage for java.util Dictionary put.

Prototype

public abstract V put(K key, V value);

Source Link

Document

Maps the specified key to the specified value in this dictionary.

Usage

From source file:net.commerce.zocalo.freechart.ChartGenerator.java

public static void addPriceSeries(List trades, Dictionary<String, TimePeriodValues> positions,
        Dictionary originalValue) {
    for (Iterator iterator = trades.iterator(); iterator.hasNext();) {
        MakerTrade trade = (MakerTrade) iterator.next();
        TimePeriodValues values = positions.get(trade.getPos().getName());
        if (values == null) {
            continue;
        }//from ww w.  j  a  v a 2  s. c  o  m
        if (originalValue.get(trade.getPos()) == null) {
            if (!trade.openValue().equals(trade.closeValue())) { // TODO This is only a transient, since opening prices weren't stored originally
                values.add(trade.openValue());
            }
            originalValue.put(trade.getPos(), trade);
        }
        values.add(trade.closeValue());
    }
}

From source file:ch.entwine.weblounge.contentrepository.fs.FileSystemContentRepositoryTest.java

/**
 * Sets up everything valid for all test runs.
 * //from   w  ww . ja va 2  s  .c  om
 * @throws Exception
 *           if setup fails
 */
@BeforeClass
public static void setUpClass() throws Exception {
    jpegContentURL = FileSystemContentRepositoryTest.class.getResource(jpegContentPath);
    pngContentURL = FileSystemContentRepositoryTest.class.getResource(pngContentPath);

    // Resource serializer
    serializer = new ResourceSerializerServiceImpl();
    serializer.addSerializer(new PageSerializer());
    serializer.addSerializer(new FileResourceSerializer());
    serializer.addSerializer(new ImageResourceSerializer());
    serializer.addSerializer(new MovieResourceSerializer());

    testRoot = new File(PathUtils.concat(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString()));
    repositoryRoot = new File(testRoot, "repository");

    // Set weblounge.home so that search index can properly be created
    System.setProperty("weblounge.home", testRoot.getAbsolutePath());
    TestUtils.startTesting();
    ElasticSearchUtils.createIndexConfigurationAt(testRoot);

    // Template
    template = EasyMock.createNiceMock(PageTemplate.class);
    EasyMock.expect(template.getIdentifier()).andReturn("templateid").anyTimes();
    EasyMock.expect(template.getStage()).andReturn("non-existing").anyTimes();
    EasyMock.replay(template);

    Set<Language> languages = new HashSet<Language>();
    languages.add(LanguageUtils.getLanguage("en"));
    languages.add(LanguageUtils.getLanguage("de"));

    // Site
    site = EasyMock.createNiceMock(Site.class);
    EasyMock.expect(site.getIdentifier()).andReturn("test").anyTimes();
    EasyMock.expect(site.getTemplate((String) EasyMock.anyObject())).andReturn(template).anyTimes();
    EasyMock.expect(site.getDefaultTemplate()).andReturn(template).anyTimes();
    EasyMock.expect(site.getLanguages()).andReturn(languages.toArray(new Language[languages.size()]))
            .anyTimes();
    EasyMock.expect(site.getModules()).andReturn(new Module[] {}).anyTimes();
    EasyMock.expect(site.getDefaultLanguage()).andReturn(LanguageUtils.getLanguage("de")).anyTimes();
    EasyMock.expect(site.getAdministrator()).andReturn(new SiteAdminImpl("admin")).anyTimes();
    EasyMock.replay(site);

    // Connect to the repository
    repository = new FileSystemContentRepository();
    repository.setSerializer(serializer);
    repository.setEnvironment(Environment.Production);
    Dictionary<String, Object> repositoryProperties = new Hashtable<String, Object>();
    repositoryProperties.put(FileSystemContentRepository.OPT_ROOT_DIR, repositoryRoot.getAbsolutePath());
    repository.updated(repositoryProperties);
    repository.connect(site);
}

From source file:org.apache.stratos.deployment.internal.CloudDeploymentServiceComponent.java

protected void activate(ComponentContext ctxt) {
    //TODO: Modify the permission in the UI
    try {/* w  w  w  . j  a  va 2s. c om*/
        ConfigurationContext configContext = DataHolder.getInstance().getServerConfigContext();
        Dictionary props = new Hashtable();
        props.put(CarbonConstants.AXIS2_CONFIG_SERVICE, AxisObserver.class.getName());
        ctxt.getBundleContext().registerService(AxisObserver.class.getName(), new CloudDeploymentInterceptor(),
                props);

        // register the role player for this configuration
        AxisConfiguration axisConfiguration = configContext.getAxisConfiguration();
        axisConfiguration.addParameter(new Parameter("rolePlayer", new SuperTenantRolePlayer()));
    } catch (Exception e) {
        log.error("CloudDeploymentServiceComponent activation failed", e);
    }
}

From source file:org.eclipse.swordfish.core.event.EventServiceImpl.java

public void postEvent(Event swordfishEvent) {
    LOG.debug("Sending event to topic [" + swordfishEvent.getTopic() + "]");
    Assert.notNull(swordfishEvent.getTopic(), "The destination topic must be supplied");
    Assert.notNull(eventAdmin, "The EventAdmin service must be supplied");

    Dictionary properties = new MapBasedDictionary(swordfishEvent.getProperties());
    properties.put(org.osgi.service.event.EventConstants.EVENT, swordfishEvent);

    org.osgi.service.event.Event event = new org.osgi.service.event.Event(swordfishEvent.getTopic(),
            properties);//from   w  w w . j  av a  2  s  .  com
    eventAdmin.postEvent(event);
}

From source file:org.apache.stratos.sso.redirector.ui.internal.SSORedirectorServiceComponent.java

protected void activate(ComponentContext ctxt) {

    // register a servlet filter for SSO redirector page
    HttpServlet redirectJSPRedirectorServlet = new HttpServlet() {
        protected void doGet(HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException {
        }/*from  www . j  a v a2 s .co m*/
    };

    Filter redirectPageFilter = new RedirectorJSPFilter();
    Dictionary redirectorPageFilterAttrs = new Hashtable(2);
    Dictionary redirectorPageFilterParams = new Hashtable(2);
    redirectorPageFilterParams.put("url-pattern", "/carbon/sso-acs/redirect_ajaxprocessor.jsp");
    redirectorPageFilterParams.put("associated-filter", redirectPageFilter);
    redirectorPageFilterParams.put("servlet-attributes", redirectorPageFilterAttrs);
    ctxt.getBundleContext().registerService(Servlet.class.getName(), redirectJSPRedirectorServlet,
            redirectorPageFilterParams);
    log.debug("Stratos SSO Redirector bundle is activated..");
}

From source file:com.buschmais.maexo.test.MaexoTests.java

/**
 * Registers a notification listener which listens to events.
 *
 * @return The listener.//from  w  ww.  j a  va2s .co  m
 * @throws MalformedObjectNameException
 *             If notification listeners object name is incorrect.
 */
protected ServiceRegistration registerNotificationListener(NotificationListener listener, ObjectName objectName)
        throws MalformedObjectNameException {
    Dictionary<String, Object> properties = new Hashtable<String, Object>();
    properties.put(ObjectName.class.getName(), objectName);
    ServiceRegistration notificationListenerServiceRegistration = this.bundleContext
            .registerService(NotificationListener.class.getName(), listener, properties);
    return notificationListenerServiceRegistration;
}

From source file:org.wso2.carbon.sso.redirector.custom.ui.SSOCustomRedirectorServiceComponent.java

protected void activate(ComponentContext ctxt) {
    log.debug("Stratos SSO Custom Redirector bundle is activating..");
    // register a servlet filter for SSO redirector page
    HttpServlet redirectJSPRedirectorServlet = new HttpServlet() {
        protected void doGet(HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException {
        }//from w  w  w  .  java 2 s .c  om
    };

    Filter redirectPageFilter = new CustomRedirectorJSPFilter();
    Dictionary redirectorPageFilterAttrs = new Hashtable(2);
    Dictionary redirectorPageFilterParams = new Hashtable(2);
    redirectorPageFilterParams.put("url-pattern", "/carbon/stratos-auth/redirect_ajaxprocessor.jsp");
    //        redirectorPageFilterParams.put("url-pattern", "/carbon/sso-acs/redirect_ajaxprocessor.jsp");
    redirectorPageFilterParams.put("associated-filter", redirectPageFilter);
    redirectorPageFilterParams.put("servlet-attributes", redirectorPageFilterAttrs);
    ctxt.getBundleContext().registerService(Servlet.class.getName(), redirectJSPRedirectorServlet,
            redirectorPageFilterParams);
    log.debug("Stratos SSO Custom Redirector bundle is activated..");
}

From source file:org.eclipse.swordfish.internal.core.event.EventServiceImpl.java

public void postEvent(Event swordfishEvent) {
    LOG.debug("Sending event to topic [" + swordfishEvent.getTopic() + "]");
    Assert.notNull(swordfishEvent.getTopic(), "The destination topic must be supplied");
    Assert.notNull(eventAdmin, "The EventAdmin service must be supplied");

    Dictionary properties = new OrderPreservingDictionary(swordfishEvent.getProperties());
    properties.put(org.osgi.service.event.EventConstants.EVENT, swordfishEvent);

    org.osgi.service.event.Event event = new org.osgi.service.event.Event(swordfishEvent.getTopic(),
            properties);//w  ww.  ja va 2  s.c om
    eventAdmin.postEvent(event);
}

From source file:com.garethahealy.camel.file.loadbalancer.example1.routes.HandlesOneFileMultipleReadersTest.java

@Override
protected String useOverridePropertiesWithConfigAdmin(Dictionary props) throws Exception {
    props.put("lb.path", rootDirectory);
    props.put("lb.maxMessagesPerPoll", 3);

    return "com.garethahealy.camel.file.loadbalancer.example1";
}

From source file:org.eclipse.swordfish.core.event.EventHandlerRegistry.java

protected Dictionary<String, Object> getEventHanlderProperties(EventHandler<T> handler) {
    Dictionary<String, Object> props = new Hashtable<String, Object>();
    props.put(EventConstants.EVENT_TOPIC, handler.getSubscribedTopic());
    if (handler.getEventFilter() != null) {
        props.put(EventConstants.EVENT_FILTER, handler.getEventFilter().getExpression());
    }//w ww.  j  av a  2 s . c  o m
    return props;
}