當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。