Package org.apache.hivemind.schema

Examples of org.apache.hivemind.schema.Schema


        ModuleDescriptor md = parse("DuplicateSchemas.xml");

        assertLoggedMessagePattern("Multiple parameters schemas specified for service MyServiceFactory. Using locally defined schema \\(at ");

        ServicePointDescriptor spd = (ServicePointDescriptor) md.getServicePoints().get(0);
        Schema nestedSchema = spd.getParametersSchema();

        assertNotNull(nestedSchema);

        ElementModel em = (ElementModel) nestedSchema.getElementModel().get(0);

        assertEquals("myParameter", em.getElementName());
    }
View Full Code Here


    {
        ModuleDescriptor md = parse("EmbeddedConfigSchema.xml");

        List points = md.getConfigurationPoints();
        ConfigurationPointDescriptor cpd = (ConfigurationPointDescriptor) points.get(0);
        Schema s = cpd.getContributionsSchema();

        List l = s.getElementModel();

        assertEquals(1, l.size());

        ElementModel em = (ElementModel) l.get(0);
View Full Code Here

    {
        ModuleDescriptor md = parse("EmbeddedParametersSchema.xml");

        List points = md.getServicePoints();
        ServicePointDescriptor spd = (ServicePointDescriptor) points.get(0);
        Schema s = spd.getParametersSchema();

        List l = s.getElementModel();

        assertEquals(1, l.size());

        ElementModel em = (ElementModel) l.get(0);
View Full Code Here

    {
        ModuleDescriptor md = parse("SetPropertyRule.xml");

        List points = md.getConfigurationPoints();
        ConfigurationPointDescriptor cpd = (ConfigurationPointDescriptor) points.get(0);
        Schema s = cpd.getContributionsSchema();
        List l = s.getElementModel();

        ElementModel em = (ElementModel) l.get(0);

        List rules = em.getRules();
View Full Code Here

    {
        ModuleDescriptor md = parse("PushAttributeRule.xml");

        List points = md.getConfigurationPoints();
        ConfigurationPointDescriptor cpd = (ConfigurationPointDescriptor) points.get(0);
        Schema s = cpd.getContributionsSchema();
        List l = s.getElementModel();

        ElementModel em = (ElementModel) l.get(0);

        List rules = em.getRules();
View Full Code Here

    {
        ModuleDescriptor md = parse("PushContentRule.xml");

        List points = md.getConfigurationPoints();
        ConfigurationPointDescriptor cpd = (ConfigurationPointDescriptor) points.get(0);
        Schema s = cpd.getContributionsSchema();
        List l = s.getElementModel();

        ElementModel em = (ElementModel) l.get(0);

        List rules = em.getRules();
View Full Code Here

            if (!(spd instanceof XmlServicePointDefinitionImpl)) {
                // TODO annotations: Externalize message
                throw new ApplicationRuntimeException("ServicePoint used as InterceptorFactory must be of type XmlServicePointDefinitionImpl");
            }
            XmlServicePointDefinitionImpl xmlServicePoint = (XmlServicePointDefinitionImpl) spd;
            Schema schema = xmlServicePoint.getParametersSchema();
            if (schema != null) {

                SchemaProcessorImpl processor = new SchemaProcessorImpl(factoryPoint.getErrorLog(),
                        schema);
               
                _convertedParameters = constructParametersContainer(schema.getRootElementClassName(), factoryPoint.getModule());
                processor.process(_convertedParameters, _parameters, contributingModule);
            }
        }
    }
View Full Code Here

            if (module instanceof XmlModuleDefinitionImpl) {
                XmlModuleDefinitionImpl xmlModule = (XmlModuleDefinitionImpl) module;
                Collection schemas = xmlModule.getSchemas();
                for (Iterator iterSchemas = schemas.iterator(); iterSchemas.hasNext();)
                {
                    Schema schema = (Schema) iterSchemas.next();
                    String schemaId = IdUtils.qualify(module.getId(), schema.getId());
                    _schemas.put(schemaId, schema);
                }
            }
        }
    }
View Full Code Here

   
                if (xspd.getParametersSchemaId() != null) {
                    ServicePointDefinition point = sourceModule.getServicePoint(xspd.getId());
   
                    XmlServicePointDefinitionImpl xmlServicePoint = (XmlServicePointDefinitionImpl) point;
                    Schema schema = findSchema(sourceModule, xspd.getParametersSchemaId(), xspd.getLocation());
                    if (schema == null) {
                        // Error-Handling has been done in findSchema already
                    } else {
                        xmlServicePoint.setParametersSchema(schema);
                        xmlServicePoint.setParametersCount(xspd.getParametersCount());
View Full Code Here

            if (cpd == null) {
                throw new ApplicationRuntimeException(XmlImplMessages.unknownConfigurationPointOfSchemaAssignment(configurationPointId, schemaAssignment));
            }
           
            String schemaId = IdUtils.qualify(sourceModule.getId(), schemaAssignment.getSchemaId());
            Schema schema = getSchema(schemaId, sourceModule.getId(), schemaAssignment.getLocation());
           
            if (schema != null) {
                // TODO: check if schema has already been set
                // TODO: more type related error handling, check root type of schema
               
                // Add parser constructor with direct reference to schema
                ConfigurationParserDefinition parserDef = new ConfigurationParserDefinitionImpl(
                        sourceModule, schemaAssignment.getLocation(), HiveMindSchemaParser.INPUT_FORMAT_NAME,
                        new HiveMindSchemaParserConstructor(schema));
               
                cpd.addParser(parserDef);
               
                // For backward compatibility change the configuration to Map if the schema uses a map too
                if (HashMap.class.getName().equals(schema.getRootElementClassName())
                        || UniqueHashMap.class.getName().equals(schema.getRootElementClassName())) {
                    // The schema assignments are mainly used for backward compatibility so we can
                    // expect to deal here with a configuration point from the core or xml module.
                    // The cast prevents us from putting the setter into the public api of the ConfigurationPointDefinition
                    if (cpd instanceof ConfigurationPointDefinitionImpl) {
                        ((ConfigurationPointDefinitionImpl) cpd).setConfigurationTypeName(Map.class.getName());
View Full Code Here

TOP

Related Classes of org.apache.hivemind.schema.Schema

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.