Examples of Extractor


Examples of org.drools.spi.Extractor

        final Pattern col = new Pattern( 0,
                                       type,
                                       "foo" );
        final Declaration dec = col.getDeclaration();
        final Extractor ext = dec.getExtractor();
        assertEquals( Fact.class,
                      ext.getExtractToClass() );

        final Fact stilton = cheese.createFact( 10 );
        stilton.setFieldValue( "name",
                               "stilton" );
        stilton.setFieldValue( "price",
View Full Code Here

Examples of org.drools.spi.Extractor

    public void testIsNullValue() {
        try {
            Assert.assertFalse( this.extractor.isNullValue( null,
                                                            this.person[0] ) );

            Extractor nullExtractor = ClassFieldExtractorCache.getInstance().getExtractor( Person.class,
                                                                                           "addresses['business'].phone",
                                                                                           getClass().getClassLoader() );
            Assert.assertTrue( nullExtractor.isNullValue( null,
                                                          this.person[0] ) );
        } catch ( final Exception e ) {
            fail( "Should not throw an exception" );
        }
    }
View Full Code Here

Examples of org.drools.spi.Extractor

    public void testIsNullValue() {
        try {
            Assert.assertFalse( this.extractor.isNullValue( null,
                                                            this.bean ) );

            Extractor nullExtractor = ClassFieldExtractorCache.getInstance().getExtractor( TestBean.class,
                                                                                           "nullAttr",
                                                                                           getClass().getClassLoader() );
            Assert.assertTrue( nullExtractor.isNullValue( null,
                                                          this.bean ) );
        } catch ( final Exception e ) {
            fail( "Should not throw an exception" );
        }
    }
View Full Code Here

Examples of org.drools.spi.Extractor

       
        Set inputs = compiler.getParserContextState().getInputs().keySet();
        for( Iterator it = inputs.iterator(); it.hasNext(); ) {
            String basefield = (String) it.next();
                       
            Extractor extr = ClassFieldExtractorCache.getExtractorclazz, basefield, classLoader );
            this.extractors.put( basefield, extr );
        }
    }
View Full Code Here

Examples of org.graylog2.plugin.inputs.Extractor

            if (ex.containsField(Extractor.FIELD_ORDER)) {
                order = (Long) ex.get(Extractor.FIELD_ORDER); // mongodb driver gives us a java.lang.Long
            }

            try {
                final Extractor extractor = extractorFactory.factory(
                        (String) ex.get(Extractor.FIELD_ID),
                        (String) ex.get(Extractor.FIELD_TITLE),
                        order.intValue(),
                        Extractor.CursorStrategy.valueOf(((String) ex.get(Extractor.FIELD_CURSOR_STRATEGY)).toUpperCase()),
                        Extractor.Type.valueOf(((String) ex.get(Extractor.FIELD_TYPE)).toUpperCase()),
View Full Code Here

Examples of org.graylog2.plugin.inputs.Extractor

            LOG.error("Missing parameters. Returning HTTP 400.");
            throw new WebApplicationException(Response.Status.BAD_REQUEST);
        }

        String id = new com.eaio.uuid.UUID().toString();
        Extractor extractor;
        try {
            extractor = extractorFactory.factory(
                    id,
                    cer.title,
                    cer.order,
View Full Code Here

Examples of org.graylog2.restclient.models.Extractor

    public Result create(String nodeId, String inputId) {
        Map<String, String[]> form = request().body().asFormUrlEncoded();
        Extractor.Type extractorType = Extractor.Type.valueOf(form.get("extractor_type")[0].toUpperCase());

        Extractor extractor;
        try {
            Node node = nodeService.loadNode(nodeId);

            try {
                extractor = extractorFactory.forCreate(
                        Extractor.CursorStrategy.valueOf(form.get("cut_or_copy")[0].toUpperCase()),
                        form.get("title")[0],
                        form.get("source_field")[0],
                        form.get("target_field")[0],
                        extractorType,
                        currentUser(),
                        Extractor.ConditionType.valueOf(form.get("condition_type")[0].toUpperCase()),
                        form.get("condition_value")[0]
                );
            } catch (NullPointerException e) {
                Logger.error("Cannot build extractor configuration.", e);
                return badRequest();
            }

            extractor.loadConfigFromForm(extractorType, form);
            extractor.loadConvertersFromForm(form);
            extractor.create(node, node.getInput(inputId));
        } catch (IOException e) {
            return status(500, views.html.errors.error.render(ApiClient.ERROR_MSG_IO, e, request()));
        } catch (APIException e) {
            String message = "Could not create extractor! We expected HTTP 200, but got a HTTP " + e.getHttpCode() + ".";
            return status(500, views.html.errors.error.render(message, e, request()));
View Full Code Here

Examples of org.graylog2.restclient.models.Extractor

            try {
                Node node = nodeService.loadNode(nodeId);

                Extractor.Type type = Extractor.Type.valueOf(importRequest.extractorType.toUpperCase());

                Extractor extractor = extractorFactory.forCreate(
                        Extractor.CursorStrategy.valueOf(importRequest.cursorStrategy.toUpperCase()),
                        importRequest.title,
                        importRequest.sourceField,
                        importRequest.targetField,
                        type,
                        currentUser(),
                        Extractor.ConditionType.valueOf(importRequest.conditionType.toUpperCase()),
                        importRequest.conditionValue
                );

                extractor.loadConfigFromImport(type, importRequest.extractorConfig);
                extractor.loadConvertersFromImport(importRequest.converters);
                extractor.setOrder(importRequest.order);
                extractor.create(node, node.getInput(inputId));
            } catch (Exception e) {
                Logger.error("Could not import extractor. Continuing.", e);
                continue;
            }
View Full Code Here

Examples of org.restlet.routing.Extractor

        // While routing requests to the redirector, extract the "kwd" query
        // parameter. For instance :
        // http://localhost:8111/search?kwd=myKeyword1+myKeyword2
        // will be routed to
        // http://www.google.com/search?q=site:mysite.org+myKeyword1%20myKeyword2
        Extractor extractor = new Extractor(getContext(), redirector);
        extractor.extractFromQuery("keywords", "kwd", true);

        // Attach the extractor to the router
        router.attach("/search", extractor);

        // Return the root router
View Full Code Here

Examples of org.restlet.routing.Extractor

                     match = match.substring(0,pos);
                     LOG.fine("redirect extraction, match="+match+", expr="+expr);
                  }
               }
               if (extraction!=null) {
                  Extractor extractor = new Extractor(parentContext,restlet);
                  for (int i=0; i<extraction.length; i++) {
                     extractor.extractFromQuery(extraction[i], extraction[i], true);
                  }
                  router.attach(match,extractor);
               } else {
                  router.attach(match,restlet);
               }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.