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


Java ValidationException类代码示例

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


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

示例1: getTestContextFields

import org.exolab.castor.xml.ValidationException; //导入依赖的package包/类
public String[] getTestContextFields() throws MarshalException, ValidationException {
	Set fields=new HashSet();
	
	for( Iterator iter=queryEntitlements.iterator(); iter.hasNext(); ) {
		QueryEntitlement entitle=(QueryEntitlement) iter.next();
		Query query=entitle.getQuery();
		
		org.ralasafe.db.sql.Query sqlQuery=query.getSqlQuery();
		Util.extractContextValueFields( sqlQuery, fields );
		
		String xmlContent=entitle.getUserCategory().getXmlContent();
		UserCategoryType unmarshal;
		unmarshal=UserCategory.unmarshal( new StringReader( xmlContent ) );
			
		DefineVariable[] variables=unmarshal.getDefineVariable();
		Util.extractContextValueFields( variables, queryManager, fields );
	}
	
	return (String[]) fields.toArray( new String[0] );
}
 
开发者ID:yswang0927,项目名称:ralasafe,代码行数:21,代码来源:QueryEntitlementHandler.java

示例2: getTestBusinessDataFieldTypes

import org.exolab.castor.xml.ValidationException; //导入依赖的package包/类
public String[] getTestBusinessDataFieldTypes() throws MarshalException, ValidationException {
	String[] fields=getTestBusinessDataFields();
	String[] types=new String[fields.length];
	
	if( !StringUtil.isEmpty( businessDataClass ) ) {
		String[][] reflectJavaBean=Util.reflectJavaBean( businessDataClass );
		
		for( int i=0; i<fields.length; i++ ) {
			String field=fields[i];
			
			for( int j=0; j<reflectJavaBean.length; j++ ) {
				String[] strings=reflectJavaBean[j];
				
				if( strings[0].equals( field ) ) {
					types[i]=strings[1];
					j=reflectJavaBean.length;
				}
			}
		}
	}
	
	return types;
}
 
开发者ID:yswang0927,项目名称:ralasafe,代码行数:24,代码来源:DecisionEntitlementHandler.java

示例3: unMarshallString

import org.exolab.castor.xml.ValidationException; //导入依赖的package包/类
public static Object unMarshallString(Reader reader, Class objectClass) throws IOException {
    Unmarshaller unmarshaller = new Unmarshaller(objectClass);
    Object castor;
    try {
        InputSource is = new InputSource(reader);
        is.setSystemId("stringBuffer");
        castor = unmarshaller.unmarshal(is);
        reader.close();
    } catch (MarshalException marshalException) {
        //TODO Juzer throw proper exception so that calling function can handle it
        throw new IOException(marshalException.getMessage());
    } catch (ValidationException validationException) {
        throw new IOException(validationException.getMessage());
    }
    return castor;
}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:17,代码来源:UncertaintyReader.java

示例4: updateServiceCompounds

import org.exolab.castor.xml.ValidationException; //导入依赖的package包/类
Map<String, ServiceCompound> updateServiceCompounds(Map<String, ServiceCompound> serviceCompounds) throws IOException, MarshalException, ValidationException {
    PollerConfiguration pollerConfiguration = readPollerConfiguration();

    for (Monitor monitor : pollerConfiguration.getMonitorCollection()) {
        if (!serviceCompounds.containsKey(monitor.getService())) {
            serviceCompounds.put(monitor.getService(), new ServiceCompound(monitor.getService()));
        }
        serviceCompounds.get(monitor.getService()).setMonitor(monitor);
    }
    for (org.opennms.netmgt.config.poller.Package pollerPackage : pollerConfiguration.getPackageCollection()) {
        for (Service service : pollerPackage.getServiceCollection()) {
            if (!serviceCompounds.containsKey(service.getName())) {
                serviceCompounds.put(service.getName(), new ServiceCompound(service.getName()));
            }
            serviceCompounds.get(service.getName()).setPollerService(service);
        }
    }
    return serviceCompounds;
}
 
开发者ID:indigo423,项目名称:opennms-config-audit,代码行数:20,代码来源:PollerChecker.java

示例5: updateServiceCompounds

import org.exolab.castor.xml.ValidationException; //导入依赖的package包/类
Map<String, ServiceCompound> updateServiceCompounds(Map<String, ServiceCompound> serviceCompounds) throws IOException, MarshalException, ValidationException {
    CollectdConfig collectdConfiguration = readCollectdConfiguration();

    for (CollectdPackage collectdPackage : collectdConfiguration.getPackages()) {
        for (Service collectdService : collectdPackage.getPackage().getServiceCollection()) {
            if (!serviceCompounds.containsKey(collectdService.getName())) {
                serviceCompounds.put(collectdService.getName(), new ServiceCompound(collectdService.getName()));
            }
            serviceCompounds.get(collectdService.getName()).setCollectdService(collectdService);
        }
    }
    for (Collector collector : collectdConfiguration.getConfig().getCollectorCollection()) {
        if (!serviceCompounds.containsKey(collector.getService())) {
                serviceCompounds.put(collector.getService(), new ServiceCompound(collector.getService()));
            }
            serviceCompounds.get(collector.getService()).setCollector(collector);
    }
    return serviceCompounds;
}
 
开发者ID:indigo423,项目名称:opennms-config-audit,代码行数:20,代码来源:CollectionChecker.java

示例6: convertCastorException

import org.exolab.castor.xml.ValidationException; //导入依赖的package包/类
/**
 * Convert the given {@code XMLException} to an appropriate exception from the
 * {@code org.springframework.oxm} hierarchy.
 * <p>A boolean flag is used to indicate whether this exception occurs during marshalling or
 * unmarshalling, since Castor itself does not make this distinction in its exception hierarchy.
 * @param ex Castor {@code XMLException} that occurred
 * @param marshalling indicates whether the exception occurs during marshalling ({@code true}),
 * or unmarshalling ({@code false})
 * @return the corresponding {@code XmlMappingException}
 */
protected XmlMappingException convertCastorException(XMLException ex, boolean marshalling) {
	if (ex instanceof ValidationException) {
		return new ValidationFailureException("Castor validation exception", ex);
	}
	else if (ex instanceof MarshalException) {
		if (marshalling) {
			return new MarshallingFailureException("Castor marshalling exception", ex);
		}
		else {
			return new UnmarshallingFailureException("Castor unmarshalling exception", ex);
		}
	}
	else {
		// fallback
		return new UncategorizedMappingException("Unknown Castor exception", ex);
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:28,代码来源:CastorMarshaller.java

示例7: getBarChartAsPNGByteArray

import org.exolab.castor.xml.ValidationException; //导入依赖的package包/类
/**
 * Helper method that returns the JFreeChart as a PNG byte array.
 *
 * @param chartName a {@link java.lang.String} object.
 * @return a byte array
 * @throws org.exolab.castor.xml.MarshalException if any.
 * @throws org.exolab.castor.xml.ValidationException if any.
 * @throws java.io.IOException if any.
 * @throws java.sql.SQLException if any.
 */
public static byte[] getBarChartAsPNGByteArray(String chartName) throws MarshalException, ValidationException, IOException, SQLException {
    BarChart chartConfig = getBarChartConfigByName(chartName);
    JFreeChart chart = getBarChart(chartName);
    ImageSize imageSize = chartConfig.getImageSize();
    int hzPixels;
    int vtPixels;
    
    if (imageSize == null) {
        hzPixels = 400;
        vtPixels = 400;
    } else {            
        hzPixels = imageSize.getHzSize().getPixels();
        vtPixels = imageSize.getVtSize().getPixels();
    }
    return ChartUtilities.encodeAsPNG(chart.createBufferedImage(hzPixels, vtPixels));
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:27,代码来源:ChartUtils.java

示例8: marshalReport

import org.exolab.castor.xml.ValidationException; //导入依赖的package包/类
/**
 * This when invoked marshals the report XML from the castor classes.
 *
 * @throws org.exolab.castor.xml.ValidationException if any.
 * @throws org.exolab.castor.xml.MarshalException if any.
 * @throws java.io.IOException if any.
 * @throws java.lang.Exception if any.
 */
public void marshalReport() throws ValidationException, MarshalException,
        IOException, Exception {

    File file = new File(ConfigFileConstants.getHome()
            + "/share/reports/AvailReport.xml");
    try {
        Writer fileWriter = new OutputStreamWriter(new FileOutputStream(file), "UTF-8");
        Marshaller marshaller = new Marshaller(fileWriter);
        marshaller.setSuppressNamespaces(true);
        marshaller.marshal(m_report);
        if (log().isDebugEnabled()) {
            log().debug(
                        "The xml marshalled from the castor classes is saved in "
                                + ConfigFileConstants.getHome()
                                + "/share/reports/AvailReport.xml");
        }
        fileWriter.close();
    } catch (Throwable e) {
        log().fatal("Exception: " + e, e);
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:30,代码来源:AvailabilityReport.java

示例9: getUsersScheduledForRole

import org.exolab.castor.xml.ValidationException; //导入依赖的package包/类
/**
 * <p>getUsersScheduledForRole</p>
 *
 * @param roleid a {@link java.lang.String} object.
 * @param time a {@link java.util.Date} object.
 * @return an array of {@link java.lang.String} objects.
 * @throws org.exolab.castor.xml.MarshalException if any.
 * @throws org.exolab.castor.xml.ValidationException if any.
 * @throws java.io.IOException if any.
 */
public String[] getUsersScheduledForRole(final String roleid, final Date time) throws MarshalException, ValidationException, IOException {
    update();

    m_readLock.lock();
    try {
        final List<String> usersScheduledForRole = new ArrayList<String>();
        
        for (final User user : m_users.values()) {
            if (_isUserScheduledForRole(user, roleid, time)) {
                usersScheduledForRole.add(user.getUserId());
            }
        }
        
        return usersScheduledForRole.toArray(new String[usersScheduledForRole.size()]);
    } finally {
        m_readLock.unlock();
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:29,代码来源:UserManager.java

示例10: getTestBusinessDataFields

import org.exolab.castor.xml.ValidationException; //导入依赖的package包/类
public String[] getTestBusinessDataFields() throws MarshalException, ValidationException {
	Set fields=new HashSet();
	
	for( Iterator iter=decisionEntitlements.iterator(); iter.hasNext(); ) {
		DecisionEntitlement entitle=(DecisionEntitlement) iter.next();
		
		String xmlContent=entitle.getBusinessData().getXmlContent();
		BusinessDataType bdt=BusinessDataType.unmarshal( new StringReader( xmlContent ) );
		DefineVariable[] defineVariables=bdt.getDefineVariable();
		Util.extractBusinessDataFields( defineVariables, fields );
	}
	
	return (String[]) fields.toArray( new String[0] );
}
 
开发者ID:yswang0927,项目名称:ralasafe,代码行数:15,代码来源:DecisionEntitlementHandler.java

示例11: write

import org.exolab.castor.xml.ValidationException; //导入依赖的package包/类
private void write() throws IOException, ValidationException, MarshalException {

        String rootElement = "uncertainties" ;
        Marshaller marshaller = new Marshaller(writer);
        marshaller.setRootElement(rootElement);

        //if (variables != null && variables.containsKey("UA_SCHEMALOCATION"))
        //    marshaller.setSchemaLocation("http://www.wldelft.nl " + variables.getValue("UA_SCHEMALOCATION") + rootElement + ".xsd");
        //else
            marshaller.setSchemaLocation("http://www.wldelft.nl http://datools.wldelft.nl/schemas/v1.3/" + rootElement + ".xsd");

        marshaller.marshal(this.uncertaintiesComplexType);
    }
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:14,代码来源:UncertaintyWriter.java

示例12: unmarshal

import org.exolab.castor.xml.ValidationException; //导入依赖的package包/类
private static <T>T unmarshal(File file, Class<T> clazz, Set<String> testedSet, String fileName) throws MarshalException, ValidationException, IOException {
    // Be conservative about what we ship, so don't be lenient
    LocalConfiguration.getInstance().getProperties().remove(CASTOR_LENIENT_SEQUENCE_ORDERING_PROPERTY);
    
    Resource resource = new FileSystemResource(file);
    System.out.println("Unmarshalling: " + resource.getURI());
    T config = CastorUtils.unmarshal(clazz, resource);
    
    assertNotNull("unmarshalled object should not be null after unmarshalling from " + file.getAbsolutePath(), config);
    testedSet.add(fileName);
    
    return config;
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:14,代码来源:WillItUnmarshalTest.java

示例13: CollectdConfigFactory

import org.exolab.castor.xml.ValidationException; //导入依赖的package包/类
/**
 * Private constructor
 * @param verifyServer 
 * @param localServer 
 * 
 * @exception java.io.IOException
 *                Thrown if the specified config file cannot be read
 * @exception org.exolab.castor.xml.MarshalException
 *                Thrown if the file does not conform to the schema.
 * @exception org.exolab.castor.xml.ValidationException
 *                Thrown if the contents do not match the required schema.
 */
private CollectdConfigFactory(String configFile, String localServer, boolean verifyServer) throws IOException, MarshalException, ValidationException {
    InputStream stream = null;
    try {
        stream = new FileInputStream(configFile);
        CollectdConfiguration config = CastorUtils.unmarshal(CollectdConfiguration.class, stream);
        m_collectdConfig = new CollectdConfig(config, localServer, verifyServer);
    } finally {
        if (stream != null) {
            IOUtils.closeQuietly(stream);
        }
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:25,代码来源:CollectdConfigFactory.java

示例14: SiteStatusViewsFactory

import org.exolab.castor.xml.ValidationException; //导入依赖的package包/类
/**
 * <p>Constructor for SiteStatusViewsFactory.</p>
 *
 * @param configFile a {@link java.lang.String} object.
 * @throws org.exolab.castor.xml.MarshalException if any.
 * @throws org.exolab.castor.xml.ValidationException if any.
 * @throws java.io.IOException if any.
 */
public SiteStatusViewsFactory(String configFile) throws MarshalException, ValidationException, IOException {
    InputStream stream = null;
    try {
        stream = new FileInputStream(configFile);
        initialize(stream);
    } finally {
        if (stream != null) {
            IOUtils.closeQuietly(stream);
        }
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:20,代码来源:SiteStatusViewsFactory.java

示例15: testSwitch1

import org.exolab.castor.xml.ValidationException; //导入依赖的package包/类
@Test
@JUnitSnmpAgents(value={
        @JUnitSnmpAgent(host=SWITCH1_IP, port=161, resource="classpath:linkd/nms17216/switch1-walk.txt")
})
@Transactional
public final void testSwitch1() throws MarshalException, ValidationException, IOException {
    m_capsd.init();
    m_capsd.start();
    m_capsd.scanSuspectInterface(SWITCH1_IP);
    

    List<OnmsIpInterface> ips = m_interfaceDao.findByIpAddress(SWITCH1_IP);
    assertTrue("Has only one ip interface", ips.size() == 1);

    OnmsIpInterface ip = ips.get(0);

    for (OnmsIpInterface ipinterface: ip.getNode().getIpInterfaces()) {
        if (ipinterface.getIfIndex() != null )
            System.out.println("SWITCH1_IP_IF_MAP.put(InetAddress.getByName(\""+ipinterface.getIpHostName()+"\"), "+ipinterface.getIfIndex()+");");
    }

    for (OnmsSnmpInterface snmpinterface: ip.getNode().getSnmpInterfaces()) {
        if ( snmpinterface.getIfName() != null)
        System.out.println("SWITCH1_IF_IFNAME_MAP.put("+snmpinterface.getIfIndex()+", \""+snmpinterface.getIfName()+"\");");
        if (snmpinterface.getIfDescr() != null)
        System.out.println("SWITCH1_IF_IFDESCR_MAP.put("+snmpinterface.getIfIndex()+", \""+snmpinterface.getIfDescr()+"\");");
        if (snmpinterface.getPhysAddr() != null)
        System.out.println("SWITCH1_IF_MAC_MAP.put("+snmpinterface.getIfIndex()+", \""+snmpinterface.getPhysAddr()+"\");");            
        if (snmpinterface.getIfAlias() != null)
        System.out.println("SWITCH1_IF_IFALIAS_MAP.put("+snmpinterface.getIfIndex()+", \""+snmpinterface.getIfAlias()+"\");");            
    }
    
    m_capsd.stop();
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:35,代码来源:LinkdNms17216CapsdNetworkBuilderTest.java


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