本文整理汇总了Java中org.kuali.rice.core.api.util.ClassLoaderUtils类的典型用法代码示例。如果您正苦于以下问题:Java ClassLoaderUtils类的具体用法?Java ClassLoaderUtils怎么用?Java ClassLoaderUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ClassLoaderUtils类属于org.kuali.rice.core.api.util包,在下文中一共展示了ClassLoaderUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: lookupFinderValue
import org.kuali.rice.core.api.util.ClassLoaderUtils; //导入依赖的package包/类
/**
* This method looks up a value in a finder class.
* @param fieldControl the type of web control that is associated with this field.
* @param prop the property to look up - either a property name as a String, or a referenced object
* @param finder finder to look the value up in
* @return the value that was returned from the lookup
*/
private static String lookupFinderValue(ControlDefinition fieldControl, Object prop, KeyValuesFinder finder) {
String propValue = null;
// KULRICE-1808 : PersistableBusinessObjectValuesFinder is not working for inquiries that have child objects with ValuesFinder populated select lists
if (finder instanceof PersistableBusinessObjectValuesFinder) {
((PersistableBusinessObjectValuesFinder) finder).setBusinessObjectClass(ClassLoaderUtils.getClass(fieldControl.getBusinessObjectClass()));
((PersistableBusinessObjectValuesFinder) finder).setKeyAttributeName(fieldControl.getKeyAttribute());
((PersistableBusinessObjectValuesFinder) finder).setLabelAttributeName(fieldControl.getLabelAttribute());
if (fieldControl.getIncludeBlankRow() != null) {
((PersistableBusinessObjectValuesFinder) finder).setIncludeBlankRow(fieldControl.getIncludeBlankRow());
}
((PersistableBusinessObjectValuesFinder) finder).setIncludeKeyInDescription(fieldControl.getIncludeKeyInLabel());
}
List<KeyValue> keyValues = finder.getKeyValues();
propValue = getPropertyValueFromList(prop, keyValues);
if(propValue==null) {
propValue = lookupInactiveFinderValue(prop, finder);
}
return propValue;
}
示例2: establishConnectionMetaData
import org.kuali.rice.core.api.util.ClassLoaderUtils; //导入依赖的package包/类
protected void establishConnectionMetaData(MetadataManager mm) throws Exception {
String connMetadata = getMetadataLocation();
if (StringUtils.isBlank(connMetadata)) {
LOG.info("No OJB connection metadata loaded.");
return;
}
if (!isConnectionAlreadyConfigured(mm)) {
LOG.info("Loading OJB Connection Metadata from " + connMetadata);
DefaultResourceLoader resourceLoader = new DefaultResourceLoader(ClassLoaderUtils.getDefaultClassLoader());
InputStream is = resourceLoader.getResource(connMetadata).getInputStream();
is = preprocessConnectionMetadata(is);
ConnectionRepository cr = mm.readConnectionRepository(is);
mm.mergeConnectionRepository(cr);
try {
is.close();
} catch (Exception e) {
LOG.warn("Failed to close stream to file " + connMetadata, e);
}
} else {
LOG.info("OJB Connections already configured for jcd aliases '" + StringUtils.join(getJcdAliases(), ", ") + "', skipping Metadata merge.");
}
}
示例3: getProxyForService
import org.kuali.rice.core.api.util.ClassLoaderUtils; //导入依赖的package包/类
protected Object getProxyForService() {
checkService();
checkServiceInterface();
ProxyFactory proxyFactory = new ProxyFactory();
for (Class<?> serviceInterface : getServiceInterfaces()) {
proxyFactory.addInterface(serviceInterface);
}
if (registerTraceInterceptor == true) {
proxyFactory.addAdvice(new RemoteInvocationTraceInterceptor(getExporterName()));
}
ClassLoader classLoader = serviceDefinition.getServiceClassLoader();
if (classLoader == null) {
classLoader = ClassLoaderUtils.getDefaultClassLoader();
}
Object service = ContextClassLoaderProxy.wrap(getService(), classLoader);
service = BAMServerProxy.wrap(service, getServiceDefinition());
proxyFactory.setTarget(service);
return proxyFactory.getProxy(classLoader);
}
示例4: getSearchableAttributeValueByDataTypeString
import org.kuali.rice.core.api.util.ClassLoaderUtils; //导入依赖的package包/类
public static SearchableAttributeValue getSearchableAttributeValueByDataTypeString(String dataType) {
SearchableAttributeValue returnableValue = null;
if (StringUtils.isBlank(dataType)) {
return returnableValue;
}
for (SearchableAttributeValue attValue : getSearchableAttributeValueObjectTypes())
{
if (dataType.equalsIgnoreCase(attValue.getAttributeDataType()))
{
if (returnableValue != null)
{
String errorMsg = "Found two SearchableAttributeValue objects with same data type string ('" + dataType + "' while ignoring case): " + returnableValue.getClass().getName() + " and " + attValue.getClass().getName();
LOG.error("getSearchableAttributeValueByDataTypeString() " + errorMsg);
throw new RuntimeException(errorMsg);
}
LOG.debug("getSearchableAttributeValueByDataTypeString() SearchableAttributeValue class name is " + attValue.getClass().getName() + "... ojbConcreteClassName is " + attValue.getOjbConcreteClass());
ObjectDefinition objDef = new ObjectDefinition(attValue.getClass());
returnableValue = (SearchableAttributeValue) ObjectDefinitionResolver.createObject(objDef, ClassLoaderUtils.getDefaultClassLoader(), false);
}
}
return returnableValue;
}
示例5: testIsWorkflowAttribute
import org.kuali.rice.core.api.util.ClassLoaderUtils; //导入依赖的package包/类
@Test
public void testIsWorkflowAttribute() throws Exception {
RuleTemplateBo template = KEWServiceLocator.getRuleTemplateService().findByRuleTemplateName("TemplateWithRuleValidationAttribute");
List<RuleTemplateAttributeBo> ruleTemplateAttributes = (List<RuleTemplateAttributeBo>) template.getRuleTemplateAttributes();
int index = 0;
for (RuleTemplateAttributeBo ruleTemplateAttribute : ruleTemplateAttributes) {
boolean isWorkflowAttribute = ruleTemplateAttribute.isWorkflowAttribute();
Object attribute = ruleTemplateAttribute.getAttribute();
attribute = ClassLoaderUtils.unwrapFromProxy(attribute);
if (index == 0) {
// should be the TestRuleAttribute
assertNotNull(attribute);
assertEquals("Should be TestRuleAttribute", TestRuleAttribute.class, attribute.getClass());
assertTrue("TestRuleAttribute is a workflow attribute.", isWorkflowAttribute);
} else if (index == 1) {
// should be the TestRuleValidationAttribute so should be null
assertEquals("Should be TestRuleValidationAttribute", TestRuleValidationAttribute.class,
attribute.getClass());
assertFalse("TestRuleValidationAttribute is not a workflow attribute", isWorkflowAttribute);
}
index++;
}
}
示例6: loadProperties
import org.kuali.rice.core.api.util.ClassLoaderUtils; //导入依赖的package包/类
private static void loadProperties( Properties props, String propertyFileName) {
InputStream propertyFileInputStream = null;
try {
try {
propertyFileInputStream = new DefaultResourceLoader(ClassLoaderUtils.getDefaultClassLoader()).getResource(propertyFileName).getInputStream();
props.load(propertyFileInputStream);
}
finally {
if (propertyFileInputStream != null) {
propertyFileInputStream.close();
}
}
}
catch (IOException e) {
LOG.error(e);
// throw new RuntimeException("PropertyLoadingFactoryBean unable to load property file: " + propertyFileName);
}
}
示例7: setParameter
import org.kuali.rice.core.api.util.ClassLoaderUtils; //导入依赖的package包/类
public static void setParameter(HttpParams params, String paramName, String paramValue) {
Class<?> paramType = getParameterType(paramName);
if (paramType.equals(Boolean.class)) {
params.setBooleanParameter(paramName, Boolean.parseBoolean(paramValue));
} else if (paramType.equals(Integer.class)) {
params.setIntParameter(paramName, Integer.parseInt(paramValue));
} else if (paramType.equals(Long.class)) {
params.setLongParameter(paramName, Long.parseLong(paramValue));
} else if (paramType.equals(Double.class)) {
params.setDoubleParameter(paramName, Double.parseDouble(paramValue));
} else if (paramType.equals(String.class)) {
params.setParameter(paramName, paramValue);
} else if (paramType.equals(Class.class)) {
try {
Class<?> configuredClass = Class.forName(paramValue, true, ClassLoaderUtils.getDefaultClassLoader());
params.setParameter(paramName, configuredClass);
} catch (ClassNotFoundException e) {
throw new RuntimeException("Could not locate the class needed to configure the HttpClient.", e);
}
} else {
throw new RuntimeException("Attempted to configure an HttpClient parameter '" + paramName + "' " +
"of a type not supported through Workflow configuration: " + paramType.getName());
}
}
示例8: testIsWorkflowAttribute
import org.kuali.rice.core.api.util.ClassLoaderUtils; //导入依赖的package包/类
@Test
public void testIsWorkflowAttribute() throws Exception {
RuleTemplateBo template = KEWServiceLocator.getRuleTemplateService().findByRuleTemplateName("TemplateWithRuleValidationAttribute");
List<RuleTemplateAttributeBo> ruleTemplateAttributes = (List<RuleTemplateAttributeBo>) template.getRuleTemplateAttributes();
int index = 0;
for (RuleTemplateAttributeBo ruleTemplateAttribute : ruleTemplateAttributes) {
boolean isWorkflowAttribute = ruleTemplateAttribute.isWorkflowAttribute();
Object attribute = ruleTemplateAttribute.getAttribute();
attribute = ClassLoaderUtils.unwrapFromProxy(attribute);
if (index == 0) {
// should be the TestRuleAttribute
assertNotNull(attribute);
assertEquals("Should be TestRuleAttribute", TestRuleAttribute.class, attribute.getClass());
assertTrue("TestRuleAttribute is a workflow attribute.", isWorkflowAttribute);
} else if (index == 1) {
// should be the TestRuleValidationAttribute so should be null
assertEquals("Should be TestRuleValidationAttribute", TestRuleValidationAttribute.class, attribute.getClass());
assertFalse("TestRuleValidationAttribute is not a workflow attribute", isWorkflowAttribute);
}
index++;
}
}
示例9: buildChain
import org.kuali.rice.core.api.util.ClassLoaderUtils; //导入依赖的package包/类
private FilterChain buildChain(HttpServletRequest request, FilterChain targetChain) {
BootstrapFilterChain chain = new BootstrapFilterChain(targetChain, ClassLoaderUtils.getDefaultClassLoader());
String requestPath = request.getServletPath();
for (FilterMapping mapping : filterMappings) {
Filter filter = filters.get(mapping.getFilterName());
if (!chain.containsFilter(filter) && matchFiltersURL(mapping.getUrlPattern(), requestPath)
&& !excludeFilter(mapping.getFilterName(), request.getRequestURL().toString())) {
chain.addFilter(filter);
}
}
return chain;
}
示例10: getAttributeFormatter
import org.kuali.rice.core.api.util.ClassLoaderUtils; //导入依赖的package包/类
/**
* @see org.kuali.rice.krad.service.DataDictionaryService#getAttributeFormatter(java.lang.String)
*/
@Override
public Class<? extends Formatter> getAttributeFormatter(String entryName, String attributeName) {
Class formatterClass = null;
AttributeDefinition attributeDefinition = getAttributeDefinition(entryName, attributeName);
if (attributeDefinition != null) {
if (attributeDefinition.hasFormatterClass()) {
formatterClass = ClassLoaderUtils.getClass(attributeDefinition.getFormatterClass());
}
}
return formatterClass;
}
示例11: getAttributeValuesFinderClass
import org.kuali.rice.core.api.util.ClassLoaderUtils; //导入依赖的package包/类
/**
* @see org.kuali.rice.krad.service.DataDictionaryService#getAttributeValuesScopeId(java.lang.Class,
* java.lang.String)
*/
@Override
public Class<? extends KeyValuesFinder> getAttributeValuesFinderClass(String entryName, String attributeName) {
Class valuesFinderClass = null;
AttributeDefinition attributeDefinition = getAttributeDefinition(entryName, attributeName);
if (attributeDefinition != null) {
String valuesFinderClassName = attributeDefinition.getControl().getValuesFinderClass();
valuesFinderClass = ClassLoaderUtils.getClass(valuesFinderClassName);
}
return valuesFinderClass;
}
示例12: getAttributeFormatter
import org.kuali.rice.core.api.util.ClassLoaderUtils; //导入依赖的package包/类
@Override
public Class<? extends Formatter> getAttributeFormatter(String entryName, String attributeName) {
Class formatterClass = null;
AttributeDefinition attributeDefinition = getAttributeDefinition(entryName, attributeName);
if (attributeDefinition != null) {
if (attributeDefinition.hasFormatterClass()) {
formatterClass = ClassLoaderUtils.getClass(attributeDefinition.getFormatterClass());
}
}
return formatterClass;
}
示例13: getAttributeValuesFinderClass
import org.kuali.rice.core.api.util.ClassLoaderUtils; //导入依赖的package包/类
/**
* @see org.kuali.rice.krad.service.DataDictionaryService#getAttributeValuesScopeId(java.lang.Class,
* java.lang.String)
*/
@Override
public Class<? extends KeyValuesFinder> getAttributeValuesFinderClass(String entryName, String attributeName) {
Class valuesFinderClass = null;
AttributeDefinition attributeDefinition = getAttributeDefinition(entryName, attributeName);
if (attributeDefinition != null) {
String valuesFinderClassName = attributeDefinition.getControl().getValuesFinderClass();
valuesFinderClass = ClassLoaderUtils.getClass(valuesFinderClassName);
}
return valuesFinderClass;
}
示例14: completeValidation
import org.kuali.rice.core.api.util.ClassLoaderUtils; //导入依赖的package包/类
@Override
public void completeValidation(Class rootObjectClass, Class otherObjectClass, ValidationTrace tracer) {
super.completeValidation(rootObjectClass, otherObjectClass,tracer);
if ( StringUtils.isNotBlank(lookupBoClass) ) {
try {
ClassUtils.getClass(ClassLoaderUtils.getDefaultClassLoader(), getLookupBoClass());
} catch (ClassNotFoundException e) {
String currentValues[] = {"property = " + getName(), "class = " + rootObjectClass.getName(), "lookupBoClass = " + getLookupBoClass()};
tracer.createError("lookupBoClass could not be found", currentValues);
}
}
}
示例15: validate
import org.kuali.rice.core.api.util.ClassLoaderUtils; //导入依赖的package包/类
@Override
public void validate() {
super.validate();
if (this.serviceInterfaces == null || this.serviceInterfaces.isEmpty()) {
Class<?>[] interfaces = ClassLoaderUtils.getInterfacesToProxy(getService(), null, null);
for (Class<?> serviceInterfaceClass : interfaces) {
this.serviceInterfaces.add(serviceInterfaceClass.getName());
}
}
}