当前位置: 首页>>代码示例>>Java>>正文


Java Dictionary类代码示例

本文整理汇总了Java中java.util.Dictionary的典型用法代码示例。如果您正苦于以下问题:Java Dictionary类的具体用法?Java Dictionary怎么用?Java Dictionary使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Dictionary类属于java.util包,在下文中一共展示了Dictionary类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeService

import java.util.Dictionary; //导入依赖的package包/类
@Override
public synchronized void removeService ( final String id, final S service )
{
    if ( this.disposed )
    {
        return;
    }

    logger.debug ( "Removing service: {} -> {}", id, service );

    final Map<S, Dictionary<?, ?>> serviceMap = this.services.get ( id );
    if ( serviceMap == null )
    {
        return;
    }
    final Dictionary<?, ?> properties = serviceMap.remove ( service );
    if ( properties != null )
    {
        if ( serviceMap.isEmpty () )
        {
            this.services.remove ( id );
        }
        fireRemoveService ( id, service, properties );
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:26,代码来源:ObjectPoolImpl.java

示例2: modified

import java.util.Dictionary; //导入依赖的package包/类
@Modified
protected void modified(ComponentContext context) {
    log.info("Received configuration change...");
    Dictionary<?, ?> properties = context != null ? context.getProperties() : new Properties();
    String newIp = get(properties, "aliasIp");
    String newMask = get(properties, "aliasMask");
    String newAdapter = get(properties, "aliasAdapter");

    // Process any changes in the parameters...
    if (!Objects.equals(newIp, aliasIp) ||
            !Objects.equals(newMask, aliasMask) ||
            !Objects.equals(newAdapter, aliasAdapter)) {
        synchronized (this) {
            log.info("Reconfiguring with aliasIp={}, aliasMask={}, aliasAdapter={}, wasLeader={}",
                     newIp, newMask, newAdapter, wasLeader);
            if (wasLeader) {
                removeIpAlias(aliasIp, aliasMask, aliasAdapter);
                addIpAlias(newIp, newMask, newAdapter);
            }
            aliasIp = newIp;
            aliasMask = newMask;
            aliasAdapter = newAdapter;
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:ClusterIpManager.java

示例3: activate

import java.util.Dictionary; //导入依赖的package包/类
private void activate ( final DataSourceFactory dataSourceFactory ) throws Exception
{
    logger.debug ( "Activate storage" );
    this.scheduler = ScheduledExportedExecutorService.newSingleThreadExportedScheduledExecutor ( "org.eclipse.scada.ae.server.storage.postgresql/ScheduledExecutor" );

    final Properties dbProperties = DataSourceHelper.getDataSourceProperties ( SPECIFIC_PREFIX, DataSourceHelper.DEFAULT_PREFIX );

    final String schema = getSchema ();
    final String instance = getInstance ();
    this.jdbcStorage = new JdbcStorage ( dataSourceFactory, this.scheduler, dbProperties, DataSourceHelper.isConnectionPool ( SPECIFIC_PREFIX, DataSourceHelper.DEFAULT_PREFIX, false ), schema, instance );
    this.jdbcStorage.start ();

    final Dictionary<String, Object> properties = new Hashtable<String, Object> ( 2 );
    properties.put ( Constants.SERVICE_DESCRIPTION, "PostgreSQL specific JDBC implementation for org.eclipse.scada.ae.server.storage.Storage" );
    properties.put ( Constants.SERVICE_VENDOR, "Eclipse SCADA Project" );
    this.jdbcStorageHandle = context.registerService ( new String[] { JdbcStorage.class.getName (), Storage.class.getName () }, this.jdbcStorage, properties );
    logger.debug ( "Storage activated - {}", this.jdbcStorageHandle );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:19,代码来源:Activator.java

示例4: createPool

import java.util.Dictionary; //导入依赖的package包/类
private void createPool ( final Storage storage, final EventManager eventManager )
{
    logger.info ( "Create pool: {}", this.id );
    try
    {
        this.pool = new EventPoolImpl ( this.executor, storage, eventManager, this.filter, this.size );

        this.pool.start ();

        logger.info ( "pool {} created", this.id );

        final Dictionary<String, String> properties = new Hashtable<String, String> ();
        properties.put ( Constants.SERVICE_PID, this.id );
        this.poolHandle = this.context.registerService ( EventQuery.class.getName (), this.pool, properties );
    }
    catch ( final Exception e )
    {
        logger.warn ( "Failed to create event pool: " + this.id, e );
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:21,代码来源:EventPoolManager.java

示例5: loadImage

import java.util.Dictionary; //导入依赖的package包/类
/**
 * Loads the image from the URL <code>getImageURL</code>. This should
 * only be invoked from <code>refreshImage</code>.
 */
private void loadImage() {
    URL src = getImageURL();
    Image newImage = null;
    if (src != null) {
        Dictionary cache = (Dictionary)getDocument().
                                getProperty(IMAGE_CACHE_PROPERTY);
        if (cache != null) {
            newImage = (Image)cache.get(src);
        }
        else {
            newImage = Toolkit.getDefaultToolkit().createImage(src);
            if (newImage != null && getLoadsSynchronously()) {
                // Force the image to be loaded by using an ImageIcon.
                ImageIcon ii = new ImageIcon();
                ii.setImage(newImage);
            }
        }
    }
    image = newImage;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:ImageView.java

示例6: addingService

import java.util.Dictionary; //导入依赖的package包/类
@Override
public StoredPerProvider addingService(ServiceReference<PersistenceProvider> reference) {
    String providerName = (String)reference.getProperty(JAVAX_PERSISTENCE_PROVIDER);
    // FIXME should be set when creating the EMF was successful
    if (punit.getPersistenceProviderClassName() == null) {
        punit.setProviderClassName(providerName);
    }
    StoredPerProvider stored = new StoredPerProvider();
    LOGGER.info("Found provider for " + punit.getPersistenceUnitName() + " " + punit.getPersistenceProviderClassName());
    
    PersistenceProvider provider = context.getService(reference);

    createAndCloseDummyEMF(provider);

    stored.builder = new AriesEntityManagerFactoryBuilder(context, provider, reference.getBundle(), punit);
    Dictionary<String, ?> props = AriesEntityManagerFactoryBuilder.createBuilderProperties(punit, punit.getBundle());
    stored.reg = context.registerService(EntityManagerFactoryBuilder.class, stored.builder , props);
    return stored;
}
 
开发者ID:apache,项目名称:aries-jpa,代码行数:20,代码来源:PersistenceProviderTracker.java

示例7: setUp

import java.util.Dictionary; //导入依赖的package包/类
protected void setUp() throws Exception {
	classes = new String[] { Object.class.getName(), Cloneable.class.getName(), Serializable.class.getName() };

	// lowest service reference
	Dictionary dict1 = new Hashtable();
	dict1.put(Constants.SERVICE_RANKING, Integer.MIN_VALUE);
	ref1 = new MockServiceReference(null, dict1, null);

	// neutral service reference
	Dictionary dict2 = new Hashtable();
	dict2.put(Constants.SERVICE_ID, (long) 20);

	ref2 = new MockServiceReference(null, dict2, null);

	// neutral service reference
	Dictionary dict3 = new Hashtable();
	dict3.put(Constants.SERVICE_ID, (long) 30);

	ref3 = new MockServiceReference(null, dict3, null);

	ctrl = createStrictControl();
	context = ctrl.createMock(BundleContext.class);

}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:25,代码来源:OsgiServiceReferenceUtilsTest.java

示例8: addSuffixToSliderLabels

import java.util.Dictionary; //导入依赖的package包/类
public static void addSuffixToSliderLabels(JSlider slider, String suffix) {

        assert (slider != null && suffix != null);

        Dictionary oldLabels = slider.getLabelTable();
        Enumeration oldKeys = oldLabels.keys();
        Hashtable newLabelTable = new Hashtable();
        while (oldKeys.hasMoreElements()) {
            Object key = oldKeys.nextElement();
            Object value = oldLabels.get(key);
            assert (value instanceof String);
            String str = ((String)value).concat(suffix);
            JLabel label = new JLabel(str);
            newLabelTable.put(key, label);
        }

        slider.setLabelTable(newLabelTable);
    }
 
开发者ID:berniejenny,项目名称:MapAnalyst,代码行数:19,代码来源:SliderUtils.java

示例9: InvocationContextImpl

import java.util.Dictionary; //导入依赖的package包/类
/**
 * Constructs a servlet invocation context for a specified servlet container,
 * request, and cookie headers.
 **/
InvocationContextImpl( ServletUnitClient client, ServletRunner runner, String target, WebRequest request, Dictionary clientHeaders, byte[] messageBody ) throws IOException, MalformedURLException {
    _client      = client;
    _application = runner.getApplication();
    _requestURL  = request.getURL();
    _target      = target;

    final ServletUnitHttpRequest suhr = new ServletUnitHttpRequest( _application.getServletRequest( _requestURL ), request, runner.getContext(),
                                                   clientHeaders, messageBody );
    _request = suhr;
    Cookie[] cookies = getCookies( clientHeaders );
    for (int i = 0; i < cookies.length; i++) suhr.addCookie( cookies[i] );

    if (_application.usesBasicAuthentication()) suhr.readBasicAuthentication();
    else if (_application.usesFormAuthentication()) suhr.readFormAuthentication();

    HttpSession session = _request.getSession( /* create */ false );
    if (session != null) ((ServletUnitHttpSession) session).access();
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:23,代码来源:InvocationContextImpl.java

示例10: start

import java.util.Dictionary; //导入依赖的package包/类
@Override
public void start ( final BundleContext context ) throws Exception
{
    Activator.instance = this;
    this.context = context;

    this.executor = Executors.newSingleThreadExecutor ( new NamedThreadFactory ( context.getBundle ().getSymbolicName () ) );
    this.factory = new SumSourceFactory ( context, this.executor );

    final Dictionary<String, String> properties = new Hashtable<String, String> ();
    properties.put ( Constants.SERVICE_DESCRIPTION, "A summary data source" );
    properties.put ( Constants.SERVICE_VENDOR, "Eclipse SCADA Project" );
    properties.put ( ConfigurationAdministrator.FACTORY_ID, context.getBundle ().getSymbolicName () );

    context.registerService ( ConfigurationFactory.class.getName (), this.factory, properties );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:17,代码来源:Activator.java

示例11: getHighestValue

import java.util.Dictionary; //导入依赖的package包/类
/**
 * Returns the biggest value that has an entry in the label table.
 *
 * @return biggest value that has an entry in the label table, or
 *         null.
 * @since 1.6
 */
protected Integer getHighestValue() {
    Dictionary dictionary = slider.getLabelTable();

    if (dictionary == null) {
        return null;
    }

    Enumeration keys = dictionary.keys();

    Integer max = null;

    while (keys.hasMoreElements()) {
        Integer i = (Integer) keys.nextElement();

        if (max == null || i > max) {
            max = i;
        }
    }

    return max;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:29,代码来源:BasicSliderUI.java

示例12: handlePotentialEclipseLink

import java.util.Dictionary; //导入依赖的package包/类
private void handlePotentialEclipseLink(Bundle b) {
    if (!ECLIPSELINK_JPA_PROVIDER_BUNDLE_SYMBOLIC_NAME.equals(b.getSymbolicName())) {
        return;
    }
    if (registeredProviders.containsKey(b)) {
        return;
    }
    
    PersistenceProvider provider = createEclipselinkProvider(b);
    if (provider == null) {
        return;
    }

    LOG.debug("Adding new EclipseLink provider for bundle {}", b);
    PersistenceProvider proxiedProvider = new EclipseLinkPersistenceProvider(provider, b);
    
    Dictionary<String, Object> props = new Hashtable<String, Object>(); // NOSONAR
    props.put("org.apache.aries.jpa.container.weaving.packages", getJPAPackages(b));
    props.put("javax.persistence.provider", ECLIPSELINK_JPA_PROVIDER_CLASS_NAME);
    ServiceRegistration<?> reg = context.registerService(PersistenceProvider.class, proxiedProvider, props);
    
    ServiceRegistration<?> old = registeredProviders.putIfAbsent(b, reg);
    if (old != null) {
        reg.unregister();
    }
}
 
开发者ID:apache,项目名称:aries-jpa,代码行数:27,代码来源:Activator.java

示例13: getProperties

import java.util.Dictionary; //导入依赖的package包/类
public Dictionary<String, ?> getProperties ()
{
    try
    {
        final Dictionary<String, Object> result = new Hashtable<String, Object> ();

        final Map<?, ?> properties = new BeanUtilsBean2 ().describe ( this.targetBean );
        for ( final Map.Entry<?, ?> entry : properties.entrySet () )
        {
            if ( entry.getValue () != null )
            {
                result.put ( entry.getKey ().toString (), entry.getValue () );
            }
        }
        return result;
    }
    catch ( final Exception e )
    {
        logger.warn ( "Failed to get dictionary", e );
        return new Hashtable<String, Object> ( 1 );
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:23,代码来源:BeanConfigurationFactory.java

示例14: connect

import java.util.Dictionary; //导入依赖的package包/类
private synchronized void connect () throws InvalidSyntaxException
{
    if ( this.configuration.masterId == null )
    {
        setUnsafe ();
        throw new RuntimeException ( String.format ( "'%s' is not set", MasterItem.MASTER_ID ) );
    }

    logger.debug ( "Setting up for master item: {}", this.configuration.masterId );

    this.tracker = new SingleObjectPoolServiceTracker<MasterItem> ( this.poolTracker, this.configuration.masterId, new ServiceListener<MasterItem> () {

        @Override
        public void serviceChange ( final MasterItem service, final Dictionary<?, ?> properties )
        {
            AbstractMasterItemMonitor.this.setMasterItem ( service );
        }
    } );

    this.tracker.open ();
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:22,代码来源:AbstractMasterItemMonitor.java

示例15: start

import java.util.Dictionary; //导入依赖的package包/类
@Override
public void start ( final BundleContext context ) throws Exception
{
    Activator.context = context;
    this.scheduler = ScheduledExportedExecutorService.newSingleThreadExportedScheduledExecutor ( context.getBundle ().getSymbolicName () + ".scheduler" );
    this.factory = new MovingAverageDataSourceFactory ( context, this.scheduler );

    final Dictionary<String, String> properties = new Hashtable<String, String> ();
    properties.put ( Constants.SERVICE_DESCRIPTION, "An averaging data source over time" );
    properties.put ( Constants.SERVICE_VENDOR, "Eclipse SCADA Project" );
    properties.put ( ConfigurationAdministrator.FACTORY_ID, context.getBundle ().getSymbolicName () );

    context.registerService ( ConfigurationFactory.class.getName (), this.factory, properties );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:15,代码来源:Activator.java


注:本文中的java.util.Dictionary类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。