當前位置: 首頁>>代碼示例>>Java>>正文


Java Properties.get方法代碼示例

本文整理匯總了Java中java.util.Properties.get方法的典型用法代碼示例。如果您正苦於以下問題:Java Properties.get方法的具體用法?Java Properties.get怎麽用?Java Properties.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.Properties的用法示例。


在下文中一共展示了Properties.get方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: configure

import java.util.Properties; //導入方法依賴的package包/類
@Override
public void configure(Type type, Properties params, Dialect dialect) throws MappingException {
	ObjectNameNormalizer normalizer = ( ObjectNameNormalizer ) params.get( IDENTIFIER_NORMALIZER );
	sequenceName = normalizer.normalizeIdentifierQuoting(
			ConfigurationHelper.getString( SEQUENCE, params, "hibernate_sequence" )
	);
	parameters = params.getProperty( PARAMETERS );

	if ( sequenceName.indexOf( '.' ) < 0 ) {
		final String schemaName = normalizer.normalizeIdentifierQuoting( params.getProperty( SCHEMA ) );
		final String catalogName = normalizer.normalizeIdentifierQuoting( params.getProperty( CATALOG ) );
		sequenceName = Table.qualify(
				dialect.quote( catalogName ),
				dialect.quote( schemaName ),
				dialect.quote( sequenceName )
		);
	}
	else {
		// if already qualified there is not much we can do in a portable manner so we pass it
		// through and assume the user has set up the name correctly.
	}

	this.identifierType = type;
	sql = dialect.getSequenceNextValString( sequenceName );
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:26,代碼來源:SequenceGenerator.java

示例2: newSAXParser

import java.util.Properties; //導入方法依賴的package包/類
/**
 * Create a <code>SAXParser</code> configured to support XML Schema and DTD
 * @param properties parser specific properties/features
 * @return an XML Schema/DTD enabled <code>SAXParser</code>
 */
public static SAXParser newSAXParser(Properties properties)
        throws ParserConfigurationException, 
               SAXException,
               SAXNotRecognizedException{ 

    SAXParserFactory factory = 
                    (SAXParserFactory)properties.get("SAXParserFactory");
    SAXParser parser = factory.newSAXParser();
    String schemaLocation = (String)properties.get("schemaLocation");
    String schemaLanguage = (String)properties.get("schemaLanguage");

    try{
        if (schemaLocation != null) {
            parser.setProperty(JAXP_SCHEMA_LANGUAGE, schemaLanguage);
            parser.setProperty(JAXP_SCHEMA_SOURCE, schemaLocation);
        }
    } catch (SAXNotRecognizedException e){
        log.info(parser.getClass().getName() + ": "  
                                    + e.getMessage() + " not supported."); 
    }
    return parser;
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:28,代碼來源:GenericParser.java

示例3: newSAXParser

import java.util.Properties; //導入方法依賴的package包/類
/**
 * Create a <code>SAXParser</code> configured to support XML Schema and DTD
 * 
 * @param properties
 *            parser specific properties/features
 * @return an XML Schema/DTD enabled <code>SAXParser</code>
 */
public static SAXParser newSAXParser(Properties properties)
		throws ParserConfigurationException, SAXException, SAXNotRecognizedException {

	SAXParserFactory factory = (SAXParserFactory) properties.get("SAXParserFactory");
	SAXParser parser = factory.newSAXParser();
	String schemaLocation = (String) properties.get("schemaLocation");
	String schemaLanguage = (String) properties.get("schemaLanguage");

	try {
		if (schemaLocation != null) {
			parser.setProperty(JAXP_SCHEMA_LANGUAGE, schemaLanguage);
			parser.setProperty(JAXP_SCHEMA_SOURCE, schemaLocation);
		}
	} catch (SAXNotRecognizedException e) {
		log.info(parser.getClass().getName() + ": " + e.getMessage() + " not supported.");
	}
	return parser;
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:26,代碼來源:GenericParser.java

示例4: newSAXParser

import java.util.Properties; //導入方法依賴的package包/類
/**
 * Create a <code>SAXParser</code> based on the underlying
 * <code>Xerces</code> version.
 * @param properties parser specific properties/features
 * @return an XML Schema/DTD enabled <code>SAXParser</code>
 */
public static SAXParser newSAXParser(Properties properties) 
        throws ParserConfigurationException, 
               SAXException,
               SAXNotSupportedException {

    SAXParserFactory factory =  
                    (SAXParserFactory)properties.get("SAXParserFactory");

    if (versionNumber == null){
        versionNumber = getXercesVersion();
        version = Float.parseFloat(versionNumber);
    }

    // Note: 2.2 is completely broken (with XML Schema). 
    if (version > 2.1) {

        configureXerces(factory);
        return factory.newSAXParser();
    } else {
        SAXParser parser = factory.newSAXParser();
        configureOldXerces(parser,properties);
        return parser;
    }
}
 
開發者ID:sunmingshuai,項目名稱:apache-tomcat-7.0.73-with-comment,代碼行數:31,代碼來源:XercesParser.java

示例5: parse

import java.util.Properties; //導入方法依賴的package包/類
void parse(Properties entries) {
    // first, strip out the platform-specific temp file template
    String tempFileTemplate = (String)entries.get("temp.file.template");
    if (tempFileTemplate != null) {
        entries.remove("temp.file.template");
        MimeTable.tempFileTemplate = tempFileTemplate;
    }

    // now, parse the mime-type spec's
    Enumeration<?> types = entries.propertyNames();
    while (types.hasMoreElements()) {
        String type = (String)types.nextElement();
        String attrs = entries.getProperty(type);
        parse(type, attrs);
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:17,代碼來源:MimeTable.java

示例6: FlumeConfiguration

import java.util.Properties; //導入方法依賴的package包/類
/**
 * Creates a populated Flume Configuration object.
 * @deprecated please use the other constructor
 */
@Deprecated
public FlumeConfiguration(Properties properties) {
  agentConfigMap = new HashMap<String, AgentConfiguration>();
  errors = new LinkedList<FlumeConfigurationError>();
  // Construct the in-memory component hierarchy
  for (Object name : properties.keySet()) {
    Object value = properties.get(name);
    if (!addRawProperty(name.toString(), value.toString())) {
      logger.warn("Configuration property ignored: " + name + " = " + value);
    }
  }
  // Now iterate thru the agentContext and create agent configs and add them
  // to agentConfigMap

  // validate and remove improperly configured components
  validateConfiguration();
}
 
開發者ID:moueimei,項目名稱:flume-release-1.7.0,代碼行數:22,代碼來源:FlumeConfiguration.java

示例7: buildSQLExceptionConverter

import java.util.Properties; //導入方法依賴的package包/類
/**
 * Build a SQLExceptionConverter instance.
 * <p/>
 * First, looks for a {@link Environment#SQL_EXCEPTION_CONVERTER} property to see
 * if the configuration specified the class of a specific converter to use.  If this
 * property is set, attempt to construct an instance of that class.  If not set, or
 * if construction fails, the converter specific to the dialect will be used.
 *
 * @param dialect    The defined dialect.
 * @param properties The configuration properties.
 * @return An appropriate SQLExceptionConverter instance.
 * @throws HibernateException There was an error building the SQLExceptionConverter.
 */
public static SQLExceptionConverter buildSQLExceptionConverter(Dialect dialect, Properties properties) throws HibernateException {
	SQLExceptionConverter converter = null;

	String converterClassName = (String) properties.get( Environment.SQL_EXCEPTION_CONVERTER );
	if ( StringHelper.isNotEmpty( converterClassName ) ) {
		converter = constructConverter( converterClassName, dialect.getViolatedConstraintNameExtracter() );
	}

	if ( converter == null ) {
		LOG.trace( "Using dialect defined converter" );
		converter = dialect.buildSQLExceptionConverter();
	}

	if ( converter instanceof Configurable ) {
		try {
			( (Configurable) converter ).configure( properties );
		}
		catch (HibernateException e) {
			LOG.unableToConfigureSqlExceptionConverter( e );
			throw e;
		}
	}

	return converter;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:39,代碼來源:SQLExceptionConverterFactory.java

示例8: startLocalManagementAgent

import java.util.Properties; //導入方法依賴的package包/類
private static synchronized void startLocalManagementAgent() {
    Properties agentProps = VMSupport.getAgentProperties();

    // start local connector if not started
    if (agentProps.get(LOCAL_CONNECTOR_ADDRESS_PROP) == null) {
        JMXConnectorServer cs = ConnectorBootstrap.startLocalConnectorServer();
        String address = cs.getAddress().toString();
        // Add the local connector address to the agent properties
        agentProps.put(LOCAL_CONNECTOR_ADDRESS_PROP, address);

        try {
            // export the address to the instrumentation buffer
            ConnectorAddressLink.export(address);
        } catch (Exception x) {
            // Connector server started but unable to export address
            // to instrumentation buffer - non-fatal error.
            warning(EXPORT_ADDRESS_FAILED, x.getMessage());
        }
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:21,代碼來源:Agent.java

示例9: handleGetObject

import java.util.Properties; //導入方法依賴的package包/類
/**
 * Gets an object for the given key from this resource bundle (if we have
 * customized translations use them otherwise return the default one).
 * Returns null if this resource bundle does not contain an object for the
 * given key.
 * 
 * @param key
 *            the key for the desired object
 * 
 * @return the object for the given key, or null
 * 
 * @throws NullPointerException
 *             if key is null
 */
@Override
public Object handleGetObject(String key) {
    if (key == null) {
        throw new NullPointerException();
    }

    final Properties properties = getProperties();
    if (properties != null) {
        final Object obj = properties.get(key);
        if (obj != null && obj.toString().trim().length() != 0) {
            return obj;
        }
    }
    if (this.getClass().equals(DbMessages.class)
            && key.startsWith("locale.")) {
        return "";
    }
    return super.handleGetObject(key);
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:34,代碼來源:DbMessages.java

示例10: newSAXParser

import java.util.Properties; //導入方法依賴的package包/類
/**
 * Create a <code>SAXParser</code> based on the underlying
 * <code>Xerces</code> version.
 * @param properties parser specific properties/features
 * @return an XML Schema/DTD enabled <code>SAXParser</code>
 */
public static SAXParser newSAXParser(Properties properties) 
        throws ParserConfigurationException, 
               SAXException,
               SAXNotSupportedException {

    SAXParserFactory factory =  
                    (SAXParserFactory)properties.get("SAXParserFactory");

    if (versionNumber == null){
        versionNumber = getXercesVersion();
        version = new Float( versionNumber ).floatValue();
    }

    // Note: 2.2 is completely broken (with XML Schema). 
    if (version > 2.1) {

        configureXerces(factory);
        return factory.newSAXParser();
    } else {
        SAXParser parser = factory.newSAXParser();
        configureOldXerces(parser,properties);
        return parser;
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:31,代碼來源:XercesParser.java

示例11: pluginVersion

import java.util.Properties; //導入方法依賴的package包/類
public static String pluginVersion() {
    String s = readResource("/plugin.properties");
    try {
        Properties properties = new Properties();
        properties.load(new StringReader(s));
        return (String) properties.get("version");
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
 
開發者ID:gocd,項目名稱:gocd-filebased-authentication-plugin,代碼行數:11,代碼來源:Util.java

示例12: setOutputFormat

import java.util.Properties; //導入方法依賴的package包/類
/**
 * Specifies an output format for this serializer. It the
 * serializer has already been associated with an output format,
 * it will switch to the new format. This method should not be
 * called while the serializer is in the process of serializing
 * a document.
 *
 * @param format The output format to use
 */
public void setOutputFormat(Properties format) {
    boolean shouldFlush = m_shouldFlush;

    if (format != null) {
        // Set the default values first,
        // and the non-default values after that,
        // just in case there is some unexpected
        // residual values left over from over-ridden default values
        Enumeration propNames;
        propNames = format.propertyNames();
        while (propNames.hasMoreElements()) {
            String key = (String) propNames.nextElement();
            // Get the value, possibly a default value
            String value = format.getProperty(key);
            // Get the non-default value (if any).
            String explicitValue = (String) format.get(key);
            if (explicitValue == null && value != null) {
                // This is a default value
                this.setOutputPropertyDefault(key,value);
            }
            if (explicitValue != null) {
                // This is an explicit non-default value
                this.setOutputProperty(key,explicitValue);
            }
        }
    }

    // Access this only from the Hashtable level... we don't want to
    // get default properties.
    String entitiesFileName =
        (String) format.get(OutputPropertiesFactory.S_KEY_ENTITIES);

    if (null != entitiesFileName) {
        String method = (String) format.get(OutputKeys.METHOD);
        m_charInfo = CharInfo.getCharInfo(entitiesFileName, method);
    }

    m_shouldFlush = shouldFlush;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:49,代碼來源:ToStream.java

示例13: getTableAttributes

import java.util.Properties; //導入方法依賴的package包/類
/**
 * Get the required table attributes like time-to-expire and partitioning-interval. For tests,
 * when enabled via TEST_EVICT, returns the values the map.
 *
 * @param tierProps the tier properties
 * @return an array with time-to-expire and partitioning-interval
 */
private long[] getTableAttributes(final Properties tierProps) {
  return TEST_EVICT && TEST_TIER_EVICT_INTERVAL.get(tierName) != null
      ? new long[] {TEST_TIER_EVICT_INTERVAL.get(tierName) * TO_MS,
          TierStoreConfiguration.DEFAULT_TIER_PARTITION_INTERVAL_MS}
      /* get the required information from table descriptor */
      : new long[] {(long) tierProps.get(TierStoreConfiguration.TIER_TIME_TO_EXPIRE),
          (long) tierProps.get(TierStoreConfiguration.TIER_PARTITION_INTERVAL)};
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:16,代碼來源:TierEvictorThread.java

示例14: upgrade

import java.util.Properties; //導入方法依賴的package包/類
@Override
public void upgrade(UpgradeResult result, File tleInstallDir) throws Exception
{
	result.setCanRetry(true);
	final File configFolder = new File(tleInstallDir, CONFIG_FOLDER);
	Properties props = loadProperties(new File(configFolder, PropertyFileModifier.MANDATORY_CONFIG));
	File indexDir = new File((String) props.get("freetext.index.location"));
	if( !indexDir.isAbsolute() )
	{
		result.addLogMessage("Freetext dir is not absolute (" + indexDir + "), skipping");
		return;
	}
	FileUtils.delete(indexDir);
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:15,代碼來源:DeleteLuceneIndex.java

示例15: CloudConfiguration

import java.util.Properties; //導入方法依賴的package包/類
public CloudConfiguration(Properties properties) {

		this.hostname = (String) properties.get("hostname");
		this.port = Integer.parseInt(properties.getProperty("port"));
		this.prefix = (String) properties.get("prefix");
	}
 
開發者ID:CentauriCloud,項目名稱:CentauriCloud,代碼行數:7,代碼來源:CloudConfiguration.java


注:本文中的java.util.Properties.get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。