Examples of Builder


Examples of aQute.bnd.osgi.Builder

        MultiMap<String,String> usedBy = new MultiMap<String,String>();
        Map<String,Set<Version>> bundleVersions = new HashMap<String,Set<Version>>();
        for (File inputFile : files) {
            if (inputFile.exists()) {
                try {
                    Builder builder;
                    if (inputFile.getName().endsWith(".bnd")) {
                        builder = setupBuilderForBndFile(inputFile);
                    } else {
                        builder = setupBuilderForJarFile(inputFile);
                    }
                    if (builder == null)
                        continue;
                    builderMap.put(inputFile, builder);
                    mergeCapabilities(exports, usedBy, bundleVersions, builder);
                } catch (CoreException e) {
                    logger.logError("Error in bnd resolution analysis.", e);
                } catch (Exception e) {
                    logger.logError("Error in bnd resolution analysis.", e);
                }
            }
        }

        // Merge together all the requirements, with access to the available
        // capabilities
        Map<String,List<ImportPackage>> imports = new HashMap<String,List<ImportPackage>>();
        Map<String,List<RequiredBundle>> requiredBundles = new HashMap<String,List<RequiredBundle>>();
        for (Entry<File,Builder> entry : builderMap.entrySet()) {
            Builder builder = entry.getValue();

            try {
                mergeRequirements(imports, exports, usedBy, requiredBundles, bundleVersions, builder);
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        // Generate the final results
        Set<File> resultFiles = builderMap.keySet();
        resultFileArray = resultFiles.toArray(new File[resultFiles.size()]);

        importResults = new ArrayList<ImportPackage>();
        for (List<ImportPackage> list : imports.values()) {
            importResults.addAll(list);
        }
        exportResults = new ArrayList<ExportPackage>();
        for (List<ExportPackage> list : exports.values()) {
            exportResults.addAll(list);
        }
        requiredBundleResults = new ArrayList<RequiredBundle>();
        for (List<RequiredBundle> list : requiredBundles.values()) {
            requiredBundleResults.addAll(list);
        }

        // Cleanup
        for (Builder builder : builderMap.values()) {
            builder.close();
        }

        // showResults(resultFileArray, importResults, exportResults);
        return Status.OK_STATUS;
    }
View Full Code Here

Examples of aQute.lib.osgi.Builder

                log.verbose("-----------------------------");
            }
            log.verbose("BND classpath: " + Arrays.asList(classpath));
        }

        Builder builder = new Builder();
        builder.setPedantic(true);
        builder.setProperties(spec);
        builder.mergeProperties(env, false);

        builder.setClasspath(classpath);
        // builder.setSourcepath(sourcepath);

        Jar jar = builder.build();

        convertErrors("BND: ", builder.getErrors());
        convertWarnings("BND: ", builder.getWarnings());

        Attributes main = jar.getManifest().getMainAttributes();
        String expHeader = main.getValue(Constants.EXPORT_PACKAGE);
        log.verbose("BND exports: " + expHeader);

        augmentImports(builder, jar, bundle);

        if (log != null)
        {
            for (String warn : warnings)
            {
                log.warn(warn);
            }
        }

        if (!errors.isEmpty())
        {
            throw new Exception(errors.toString());
        }

        boolean modified = false;
        File output = new File(dest);

        if (!output.exists() || force || (output.lastModified() <= jar.lastModified())
            || (output.lastModified() <= project.getLastModified()))
        {
            modified = true;
            // jar.write(dest) catches and ignores IOException
            OutputStream out = new FileOutputStream(dest);
            jar.write(out);
            out.close();
            jar.close();
        }

        builder.close();

        return modified;
    }
View Full Code Here

Examples of bg.smoc.model.GradeProto.Grade.Builder

        // }
        os.flush();
    }

    private void sendProtobuf() throws AgentException, IOException {
        Builder protoBuilder = GradeProto.Grade.newBuilder();
        protoBuilder.setTaskName(currentJob.getTask());
        protoBuilder.setLanguage(currentJob.getLanguage());
        Task task = getTask();
        if (currentJob.getType() != JobType.TEST) {
            if (task.getType() == Task.PROBLEM_TYPE_OUTPUT) {
                try {
                    protoBuilder.addTestIndexes(Integer.parseInt(currentJob.getTestIndex()));
                } catch (NumberFormatException e) {
                    throw new AgentException("Invalid test index.");
                }
            } else {
                Contest contest = extractContest();
                protoBuilder.addAllTestIndexes(task.getTestIndexesByJobType(currentJob.getType(),
                        !currentJob.isNotGradeFeedback(),
                        contest.isFeedbackOn()));
            }
            for (BigDecimal points : task.getTestsPoints(protoBuilder.getTestIndexesList())) {
                protoBuilder.addMaxPoints(points.toString());
            }
        }
        protoBuilder.setExplicitGrade(currentJob.getType() == JobType.GRADE);
        protoBuilder.setTaskType(task.getType());
        protoBuilder.setTimeLimit(task.getTimeLimit());
        protoBuilder.setMemoryLimit(task.getMemoryLimit());
        protoBuilder.setOutputLimit(task.getOutputLimit());
        protoBuilder.setTestsCount(task.getNumberOfTests());

        Grade gradeProto = protoBuilder.build();
        DataOutputStream dataOutput = new DataOutputStream(os);
        dataOutput.writeInt(gradeProto.getSerializedSize());
        gradeProto.writeTo(dataOutput);
        // we will continue work with os, so do not close dataOutput.
    }
View Full Code Here

Examples of ch.qos.logback.classic.net.testObjectBuilders.Builder

  // Builder builder = new MinimalExtBuilder();
  // runPerfTest(builder, "Minimal object externalization");
  // }

  public void testWithMinimalSerialization() throws Exception {
    Builder builder = new MinimalSerBuilder();
    runPerfTest(builder, "Minimal object serialization");
  }
View Full Code Here

Examples of client.net.sf.saxon.ce.event.Builder

            ((TextFragmentValue)root).setConfiguration(controller.getConfiguration());
        } else {
            try {
                XPathContext c2 = context.newMinorContext();

                Builder builder = controller.makeBuilder();

                //receiver.setSystemId(getBaseURI());
                builder.setBaseURI(getBaseURI());

                PipelineConfiguration pipe = controller.makePipelineConfiguration();
                builder.setPipelineConfiguration(pipe);

                c2.changeOutputDestination(builder, false);
                Receiver out = c2.getReceiver();
                out.open();
                out.startDocument();

                content.process(c2);

                out.endDocument();
                out.close();

                root = (DocumentInfo)builder.getCurrentRoot();
            } catch (XPathException e) {
                e.maybeSetLocation(getSourceLocator());
                e.maybeSetContext(context);
                throw e;
            }
View Full Code Here

Examples of cn.jpush.api.push.model.notification.AndroidNotification.Builder

        this.title = title;
        this.openPage = openPage;
    }
   
    public static Builder newBuilder() {
        return new Builder();
    }
View Full Code Here

Examples of com.akdeniz.googleplaycrawler.GooglePlay.BulkDetailsRequest.Builder

    }

    /** Equivalent of details but bulky one! */
    public BulkDetailsResponse bulkDetails(List<String> packageNames) throws IOException {

  Builder bulkDetailsRequestBuilder = BulkDetailsRequest.newBuilder();
  bulkDetailsRequestBuilder.addAllDocid(packageNames);

  ResponseWrapper responseWrapper = executePOSTRequest(BULKDETAILS_URL, bulkDetailsRequestBuilder.build().toByteArray(),
    "application/x-protobuf");

  return responseWrapper.getPayload().getBulkDetailsResponse();
    }
View Full Code Here

Examples of com.asakusafw.compiler.operator.OperatorMethodDescriptor.Builder

        });
        if (a.hasError()) {
            return null;
        }

        Builder builder = new Builder(getTargetAnnotationType(), context);
        builder.addAttribute(a.getObservationCount());
        builder.setDocumentation(a.getExecutableDocument());
        builder.addInput(
                a.getParameterDocument(0),
                a.getParameterName(0),
                a.getParameterType(0).getType(),
                0);
        builder.addOutput(
                "結果",
                annotation.outputPort(),
                a.getParameterType(0).getType(),
                a.getParameterName(0),
                0);
        for (int i = 1, n = a.countParameters(); i < n; i++) {
            builder.addParameter(
                    a.getParameterDocument(i),
                    a.getParameterName(i),
                    a.getParameterType(i).getType(),
                    i);
        }
        return builder.toDescriptor();
    }
View Full Code Here

Examples of com.basho.riak.client.raw.http.HTTPClientConfig.Builder

     * @see
     * com.basho.riak.client.raw.config.ClusterConfig#forHosts(com.basho.riak
     * .client.raw.config.Configuration, java.lang.String[])
     */
    @Override public ClusterConfig<HTTPClientConfig> addHosts(HTTPClientConfig config, String... hosts) {
        Builder b = HTTPClientConfig.Builder.from(config);

        for (String host : hosts) {
            addClient(b.withHost(host).build());
        }

        return this;
    }
View Full Code Here

Examples of com.basho.riak.client.raw.pbc.PBClientConfig.Builder

    /* (non-Javadoc)
     * @see com.basho.riak.client.raw.config.ClusterConfig#forHosts(com.basho.riak.client.raw.config.Configuration, java.lang.String[])
     */
    @Override public ClusterConfig<PBClientConfig> addHosts(PBClientConfig config, String... hosts) {
        Builder b = PBClientConfig.Builder.from(config);

        for(String host : hosts) {
            addClient(b.withHost(host).build());
        }

        return this;
    }
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.