@Override public void handleMessage(Message msg) { Context context = getContext(); if (context == null) { Log.e(TAG, "error handling message, getContext() returned null"); return; } switch (msg.arg1) { case COMMAND_CHANGE_TITLE: if (context instanceof Activity) { ((Activity) context).setTitle((String) msg.obj); } else { Log.e(TAG, "error handling message, getContext() returned no Activity"); } break; case COMMAND_TEXTEDIT_HIDE: if (mTextEdit != null) { mTextEdit.setVisibility(View.GONE); InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(mTextEdit.getWindowToken(), 0); } break; default: if ((context instanceof SDLActivity) && !((SDLActivity) context).onUnhandledMessage(msg.arg1, msg.obj)) { Log.e(TAG, "error handling message, command is " + msg.arg1); } } }
private static void defineProperties(Context cx, JaggeryContext context, ScriptableObject scope) { JavaScriptProperty request = new JavaScriptProperty("request"); HttpServletRequest servletRequest = (HttpServletRequest) context.getProperty(SERVLET_REQUEST); request.setValue(cx.newObject(scope, "Request", new Object[] {servletRequest})); request.setAttribute(ScriptableObject.READONLY); RhinoEngine.defineProperty(scope, request); JavaScriptProperty response = new JavaScriptProperty("response"); HttpServletResponse servletResponse = (HttpServletResponse) context.getProperty(SERVLET_RESPONSE); response.setValue(cx.newObject(scope, "Response", new Object[] {servletResponse})); response.setAttribute(ScriptableObject.READONLY); RhinoEngine.defineProperty(scope, response); JavaScriptProperty session = new JavaScriptProperty("session"); session.setValue(cx.newObject(scope, "Session", new Object[] {servletRequest.getSession()})); session.setAttribute(ScriptableObject.READONLY); RhinoEngine.defineProperty(scope, session); JavaScriptProperty application = new JavaScriptProperty("application"); ServletContext servletConext = (ServletContext) context.getProperty(Constants.SERVLET_CONTEXT); application.setValue(cx.newObject(scope, "Application", new Object[] {servletConext})); application.setAttribute(ScriptableObject.READONLY); RhinoEngine.defineProperty(scope, application); if (isWebSocket(servletRequest)) { JavaScriptProperty websocket = new JavaScriptProperty("webSocket"); websocket.setValue(cx.newObject(scope, "WebSocket", new Object[0])); websocket.setAttribute(ScriptableObject.READONLY); RhinoEngine.defineProperty(scope, websocket); } }
public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { // System.out.println("in mapper, input "+ key + " " + value + ";"); // userRow = null; userRow = value.toString().split("\\s"); if (userRow.length == 1) { userRow = null; return; } // friendList = null; friendList = userRow[1].split(","); for (i = 0; i < friendList.length; i++) { keyUser.set(new Text(friendList[i])); for (j = 0; j < friendList.length; j++) { if (j == i) { continue; } suggTuple.set(friendList[j] + ",1"); context.write(keyUser, suggTuple); // System.out.println(keyUser + ",(" + suggTuple + ")"); } existingFriend.set(userRow[0] + ",-1"); context.write(keyUser, existingFriend); // System.out.println(keyUser + ",(" + existingFriend + ")"); } /*DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); Date date = new Date(); System.out.println("Mapper done at: " + dateFormat.format(date)); //2014/08/06 15:59:48*/ }
static { Context initContext = null; try { initContext = new InitialContext(); Context envContext = (Context) initContext.lookup("java:/comp/env"); datasource = (DataSource) envContext.lookup("jdbc/QAHUB"); } catch (NamingException e) { e.printStackTrace(); // To change body of catch statement use File | Settings | File // Templates. } // Connection conn = ds.getConnection(); // // // inStream=ConnectionSource.class.getClass().getResourceAsStream("/dbcpConfig.properties"); // pro=new Properties(); // // try { // pro.load(inStream); // datasource=BasicDataSourceFactory.createDataSource(pro); // } catch (Exception e) { // e.printStackTrace(); // throw new RuntimeException("DataSource Initialization Exception"); // } }
private boolean funcLocMixVeloOk(Context ctx1, Context ctx2) { // boolean function 4 String v1 = (String) ctx1.get(Context.FLD_OBJECT); String v2 = (String) ctx1.get(Context.FLD_TIMESTAMP); String v3 = (String) ctx2.get(Context.FLD_OBJECT); String v4 = (String) ctx2.get(Context.FLD_TIMESTAMP); if (v1 == null || v2 == null || v3 == null || v4 == null) { return false; } StringTokenizer st = new StringTokenizer(v1); double x1 = Double.parseDouble(st.nextToken()); double y1 = Double.parseDouble(st.nextToken()); st = new StringTokenizer(v3); double x2 = Double.parseDouble(st.nextToken()); double y2 = Double.parseDouble(st.nextToken()); double dist = Coordinates.calDist(x1, y1, x2, y2); long t = TimeFormat.convert(v4) - TimeFormat.convert(v2) - STAY_TIME; // Different here // The velocity should be between vmin and vmax boolean result = false; double vmin = (VELOCITY * ((double) t / 1000) - 2 * ERR) / ((double) t / 1000); double vmax = (VELOCITY * ((double) t / 1000) + 2 * ERR) / ((double) t / 1000); double ve = dist / ((double) t / 1000); if (ve >= vmin && ve <= vmax) { result = true; } return result; }
/** * Expert users can override this method for more complete control over the execution of the * Mapper. * * @param context * @throws IOException */ public void run(Context context) throws IOException, InterruptedException { setup(context); while (context.nextKeyValue()) { map(context.getCurrentKey(), context.getCurrentValue(), context); } cleanup(context); }
@Override public void init(Context context, Properties initProps) { dataField = context.getEntityAttribute("dataField"); encoding = context.getEntityAttribute("encoding"); entityProcessor = (EntityProcessorWrapper) context.getEntityProcessor(); /*no op*/ }
/* (non-Javadoc) * @see org.apache.hadoop.mapreduce.Mapper#setup(org.apache.hadoop.mapreduce.Mapper.Context) */ protected void setup(Context context) throws IOException, InterruptedException { Configuration conf = context.getConfiguration(); if (conf.getBoolean("debug.on", false)) { LOG.setLevel(Level.DEBUG); System.out.println("in debug mode"); } fieldDelim = conf.get("field.delim", ","); subFieldDelim = conf.get("sub.field.delim", ":"); String ratingFilePrefix = conf.get("utp.rating.file.prefix", "rating"); isRatingFileSplit = ((FileSplit) context.getInputSplit()).getPath().getName().startsWith(ratingFilePrefix); String ratingStatFilePrefix = conf.get("utp.rating.stat.file.prefix", "stat"); isRatingStatFileSplit = ((FileSplit) context.getInputSplit()) .getPath() .getName() .startsWith(ratingStatFilePrefix); linearCorrelation = conf.getBoolean("utp.correlation.linear", true); int ratingTimeWindow = conf.getInt("utp.rating.time.window.hour", -1); ratingTimeCutoff = ratingTimeWindow > 0 ? System.currentTimeMillis() / 1000 - ratingTimeWindow * 60L * 60L : -1; minInputRating = conf.getInt("utp.min.input.rating", -1); minCorrelation = conf.getInt("utp.min.correlation", -1); userRatingWithContext = conf.getBoolean("utp.user.rating.with.context", false); LOG.info("isRatingFileSplit:" + isRatingFileSplit); }
public void reduce(CoordsTimestampTuple tuple, Iterable<IntWritable> timestamps, Context context) throws IOException, InterruptedException { Configuration conf = context.getConfiguration(); int numberOfRecords = conf.getInt("number.of.records", 0); int lastTimestamp = 0; double gridDensity = 1.0; Iterator<IntWritable> it = timestamps.iterator(); if (it.hasNext()) { lastTimestamp = it.next().get(); } while (it.hasNext()) { int timestamp = it.next().get(); gridDensity = updatedGridDensity(gridDensity, lastTimestamp, timestamp); lastTimestamp = timestamp; } if (lastTimestamp < numberOfRecords) { gridDensity = updatedGridDensity(gridDensity, lastTimestamp, numberOfRecords); } String outputValue = new DecimalFormat("#0.00000", SYMBOLS).format(gridDensity); context.write(tuple.getCoords(), new Text(outputValue)); }
@Override public void started() { // As DateFormats are generally not-thread save, // we always create a new one. DateFormat dateTimeFormat = new SimpleDateFormat("yyyy.MM.dd 'at' hh:mm:ss z"); LOG.info( "{} {} started on {}", new Object[] { Server.getApplicationName(), Misc.getAppVersionNonNull(), dateTimeFormat.format(new Date()) }); // add server notification ServerNotification sn = new ServerNotification("Server started"); Configuration conf = getContext().getService(Configuration.class); int port = conf.getInt(ServerConfiguration.PORT); sn.addLine( String.format( "Server has been started on port %d." + " There are %d accounts. " + "See server log for more info.", port, context.getAccountsService().getAccountsSize())); context.getServerNotifications().addNotification(sn); createAdminIfNoUsers(); }
public void map(Object key, Text value, Context context) throws IOException, InterruptedException { NodeWritable n = new NodeWritable(value.toString().trim()); // Emit node to carry forward the Model. NodeWritable p = new NodeWritable(value.toString().trim()); p.setIsNode(new Text("YES")); p.setIsInList(new Text("***")); context.write(new Text(p.getNid().toString()), p); // For Each OutLinks Emit This Node for (NodeWritable x : n.getOuts()) { if (!x.getNid().toString().equals(n.getNid().toString())) { n.setIsInList(new Text("YES")); n.setIsNode(new Text("NO")); context.write(new Text(x.getNid().toString()), n); } } // For Each Inlinks Emit This Node for (NodeWritable x : n.getIns()) { if (!x.getNid().toString().equals(n.getNid().toString())) { n.setIsInList(new Text("NO")); n.setIsNode(new Text("NO")); context.write(new Text(x.getNid().toString()), n); } } }
public boolean startServer() { context.starting(); Configuration configuration = getContext().getService(Configuration.class); int port = configuration.getInt(ServerConfiguration.PORT); try { context.getServer().setCharset("ISO-8859-1"); // open a non-blocking server socket channel sSockChan = ServerSocketChannel.open(); sSockChan.configureBlocking(false); // bind to localhost on designated port // ***InetAddress addr = InetAddress.getLocalHost(); // ***sSockChan.socket().bind(new InetSocketAddress(addr, port)); sSockChan.socket().bind(new InetSocketAddress(port)); // get a selector for multiplexing the client channels readSelector = Selector.open(); } catch (IOException ex) { LOG.error("Could not listen on port: " + port, ex); return false; } LOG.info("Listening for connections on TCP port {} ...", port); context.started(); return true; }
public void reduce(IntWritable key, Iterable<IntWritable> values, Context context) throws IOException { try { LOG.info( "Reading in " + vertexName + " taskid " + context.getTaskAttemptID().getTaskID().getId() + " key " + key.get()); LOG.info( "Sleeping in FinalReduce" + ", vertexName=" + vertexName + ", taskAttemptId=" + context.getTaskAttemptID() + ", reduceSleepDuration=" + reduceSleepDuration + ", reduceSleepCount=" + reduceSleepCount + ", sleepLeft=" + (reduceSleepDuration * (reduceSleepCount - count))); context.setStatus( "Sleeping... (" + (reduceSleepDuration * (reduceSleepCount - count)) + ") ms left"); if ((reduceSleepCount - count) > 0) { Thread.sleep(reduceSleepDuration); } } catch (InterruptedException ex) { throw (IOException) new IOException("Interrupted while sleeping").initCause(ex); } count++; }
@Override protected void setup(final Context context) { try { schema = Schema.fromJson( context .getConfiguration() .get(AddElementsFromHdfsJobFactory.SCHEMA) .getBytes(CommonConstants.UTF_8)); } catch (final UnsupportedEncodingException e) { throw new SchemaException("Unable to deserialise schema from JSON"); } try { final Class<?> elementConverterClass = Class.forName( context .getConfiguration() .get(AccumuloStoreConstants.ACCUMULO_ELEMENT_CONVERTER_CLASS)); elementConverter = (AccumuloElementConverter) elementConverterClass.getConstructor(Schema.class).newInstance(schema); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { throw new IllegalArgumentException( "Failed to create accumulo element converter from class", e); } }
public void performJNDILookup(Context context, PoolConfiguration poolProperties) { Object jndiDS = null; try { if (context != null) { jndiDS = context.lookup(poolProperties.getDataSourceJNDI()); } else { log.warn("dataSourceJNDI property is configued, but local JNDI context is null."); } } catch (NamingException e) { log.debug( "The name \"" + poolProperties.getDataSourceJNDI() + "\" can not be found in the local context."); } if (jndiDS == null) { try { context = new InitialContext(); jndiDS = context.lookup(poolProperties.getDataSourceJNDI()); } catch (NamingException e) { log.warn( "The name \"" + poolProperties.getDataSourceJNDI() + "\" can not be found in the InitialContext."); } } if (jndiDS != null) { poolProperties.setDataSource(jndiDS); } }
public MetaData getMetaData(int index) { if (indexMap == null || indexMap.length < index + 1) { int startFrom = 0; int lastIndex = index; if (indexMap != null) { startFrom = indexMap.length; indexMap = Arrays.copyOf(indexMap, index + 1); } else { String[] headers = context.headers(); if (headers != null && lastIndex < headers.length) { lastIndex = headers.length; } int[] indexes = context.extractedFieldIndexes(); if (indexes != null) { for (int i = 0; i < indexes.length; i++) { if (lastIndex < indexes[i]) { lastIndex = indexes[i]; } } } indexMap = new MetaData[lastIndex + 1]; } for (int i = startFrom; i < lastIndex + 1; i++) { indexMap[i] = new MetaData(i); } } return indexMap[index]; }
@Override protected void setup(Context context) throws IOException, InterruptedException { super.setup(context); setupGCBins(context.getConfiguration()); genomeAdmin = HBaseGenomeAdmin.getHBaseGenomeAdmin(context.getConfiguration()); variationAdmin = VariationAdmin.getInstance(context.getConfiguration()); genomeName = context.getConfiguration().get("genome"); parentGenome = context.getConfiguration().get("parent"); genome = genomeAdmin.getGenomeTable().getGenome(genomeName); if (genome == null) throw new IOException("Genome " + genome + " is missing."); try { SNVProbability table = (SNVProbability) variationAdmin.getTable(VariationTables.SNVP.getTableName()); snvProbabilities = table.getProbabilities(); SizeProbability sizeTable = (SizeProbability) variationAdmin.getTable(VariationTables.SIZE.getTableName()); sizeProbabilities = sizeTable.getProbabilities(); variationList = sizeTable.getVariationList(); variationList.add("SNV"); } catch (ProbabilityException e) { throw new InterruptedException("Failed to start mapper: " + e); } varTable = (VariationCountPerBin) variationAdmin.getTable(VariationTables.VPB.getTableName()); }
/** * Reads binary data from the input stream * * @return the json token read * @throws IOException if an I/O error occurs */ protected JsonToken handleBinary() throws IOException { int size = _in.readInt(); byte subtype = _in.readByte(); Context ctx = getContext(); switch (subtype) { case BsonConstants.SUBTYPE_BINARY_OLD: int size2 = _in.readInt(); byte[] buf2 = new byte[size2]; _in.readFully(buf2); ctx.value = buf2; break; case BsonConstants.SUBTYPE_UUID: long l1 = _in.readLong(); long l2 = _in.readLong(); ctx.value = new UUID(l1, l2); break; default: byte[] buf = new byte[size]; _in.readFully(buf); ctx.value = buf; break; } return JsonToken.VALUE_EMBEDDED_OBJECT; }
@Override public void put(String name, Scriptable start, Object value) { int info = findInstanceIdInfo(name); if (info != 0) { if (start == this && isSealed()) { throw Context.reportRuntimeError1("msg.modify.sealed", name); } int attr = (info >>> 16); if ((attr & READONLY) == 0) { if (start == this) { int id = (info & 0xFFFF); setInstanceIdValue(id, value); } else { start.put(name, start, value); } } return; } if (prototypeValues != null) { int id = prototypeValues.findId(name); if (id != 0) { if (start == this && isSealed()) { throw Context.reportRuntimeError1("msg.modify.sealed", name); } prototypeValues.set(id, start, value); return; } } super.put(name, start, value); }
/** * Check this expression and return an object that describes its type (or throw an exception if an * unrecoverable error occurs). */ public Type typeOf(Context ctxt, VarEnv env) throws Diagnostic { if (ctxt.isStatic()) { throw new Failure(pos, "Cannot access this in a static context"); } size = ctxt.getCurrMethod().getSize(); return ctxt.getCurrClass(); }
@Override public Double calculate(Context context) { // throw an IllegalArgumentException when there is no value for the name if (context.value(name) == null) throw new IllegalArgumentException("No value for this variable: " + name); return context.value(name); }
private RootConfig getRootConfig(Context context) { ModuleConfig moduleConfig = getModuleConfig(context, "irrelevant", DEFAULT_PROP_BATCH_SIZE); String subDirForPrefix = context.getString(PROP_SUBDIR_FOR_PREFIX, DEFAULT_PROP_SUBDIR_FOR_PREFIX); Preconditions.checkArgument( StringUtils.isNotBlank(subDirForPrefix) && !subDirForPrefix.contains("/")); Context modulesContext = new Context(context.getSubProperties(Joiner.on(".").join(PROP_MODULE_LIST, ""))); Set<String> includedModules = getProperty(modulesContext, PROP_INCLUDE); Set<String> excludedModules = getProperty(modulesContext, PROP_EXCLUDE); if (!includedModules.isEmpty() && !excludedModules.isEmpty()) { throw new IllegalArgumentException( String.format( "%s and %s are mutually exclusive for property %s. Provided values: included=%s, excluded=%s", PROP_INCLUDE, PROP_EXCLUDE, PROP_MODULE_LIST, includedModules, excludedModules)); } return new RootConfig( includedModules, excludedModules, moduleConfig.include, moduleConfig.exclude, moduleConfig.skipBatching, moduleConfig.isolate, moduleConfig.batchSize, subDirForPrefix); }
public static JaggeryContext clonedJaggeryContext(ServletContext context) { JaggeryContext shared = sharedJaggeryContext(context); RhinoEngine engine = shared.getEngine(); Scriptable sharedScope = shared.getScope(); Context cx = Context.getCurrentContext(); ScriptableObject instanceScope = (ScriptableObject) cx.newObject(sharedScope); instanceScope.setPrototype(sharedScope); instanceScope.setParentScope(null); JaggeryContext clone = new JaggeryContext(); clone.setEngine(engine); clone.setTenantId(shared.getTenantId()); clone.setScope(instanceScope); clone.addProperty(Constants.SERVLET_CONTEXT, shared.getProperty(Constants.SERVLET_CONTEXT)); clone.addProperty(LogHostObject.LOG_LEVEL, shared.getProperty(LogHostObject.LOG_LEVEL)); clone.addProperty( FileHostObject.JAVASCRIPT_FILE_MANAGER, shared.getProperty(FileHostObject.JAVASCRIPT_FILE_MANAGER)); clone.addProperty( Constants.JAGGERY_CORE_MANAGER, shared.getProperty(Constants.JAGGERY_CORE_MANAGER)); clone.addProperty(Constants.JAGGERY_INCLUDED_SCRIPTS, new HashMap<String, Boolean>()); clone.addProperty(Constants.JAGGERY_INCLUDES_CALLSTACK, new Stack<String>()); clone.addProperty(Constants.JAGGERY_REQUIRED_MODULES, new HashMap<String, ScriptableObject>()); CommonManager.setJaggeryContext(clone); return clone; }
@Override public IStrategoTerm invoke(Context context, IStrategoTerm term, Strategy n_18) { ITermFactory termFactory = context.getFactory(); context.push("Overlays_1_0"); Fail56: { IStrategoTerm u_109 = null; IStrategoTerm t_109 = null; if (term.getTermType() != IStrategoTerm.APPL || extraction._consOverlays_1 != ((IStrategoAppl) term).getConstructor()) break Fail56; t_109 = term.getSubterm(0); IStrategoList annos32 = term.getAnnotations(); u_109 = annos32; term = n_18.invoke(context, t_109); if (term == null) break Fail56; term = termFactory.annotateTerm( termFactory.makeAppl(extraction._consOverlays_1, new IStrategoTerm[] {term}), checkListAnnos(termFactory, u_109)); context.popOnSuccess(); if (true) return term; } context.popOnFailure(); return null; }
/** * Establishes a connection to a registry. * * @param queryUrl the URL of the query registry * @param publishUrl the URL of the publish registry */ public void makeConnection(String queryUrl, String publishUrl) { Context context = null; ConnectionFactory factory = null; /* * Define connection configuration properties. * To publish, you need both the query URL and the * publish URL. */ Properties props = new Properties(); props.setProperty("javax.xml.registry.queryManagerURL", queryUrl); props.setProperty("javax.xml.registry.lifeCycleManagerURL", publishUrl); try { // Create the connection, passing it the // configuration properties context = new InitialContext(); factory = (ConnectionFactory) context.lookup("java:comp/env/eis/JAXR"); factory.setProperties(props); connection = factory.createConnection(); System.out.println("Created connection to registry"); } catch (Exception e) { e.printStackTrace(); if (connection != null) { try { connection.close(); } catch (JAXRException je) { } } } }
@Start public void start() { Log.debug("Start WSChan"); clients = new HashMap<>(); if (path == null) { path = ""; } ContainerRoot model = modelService.getPendingModel(); if (model == null) { model = modelService.getCurrentModel().getModel(); } Channel thisChan = (Channel) model.findByPath(context.getPath()); Set<String> inputPaths = Helper.getProvidedPortsPath(thisChan, context.getNodeName()); Set<String> outputPaths = Helper.getRequiredPortsPath(thisChan, context.getNodeName()); for (String path : inputPaths) { // create input WSMsgBroker clients createInputClient(path + "_" + context.getInstanceName()); } for (String path : outputPaths) { // create output WSMsgBroker clients createOutputClient(path + "_" + context.getInstanceName()); } }
@Test(expected = IllegalArgumentException.class) public void shouldComplainAboutWrongTypes() { Context<?, ?> context = new FilteringContext<>("test", new SimpleConfig(1, 2), testFilters, testBlacklist); context.config(KeyValueConfig.class); }
private Type parseNumericalTerm(Context cntx) { Type type = parseNumericalFactor(cntx); while (canStartFactor.contains(cntx.peek())) { Token op; String opName; if (cntx.peek() == Token.TIMES || cntx.peek() == Token.DIVIDE) { op = cntx.next(); opName = cntx.tokstr; } else { op = Token.TIMES; opName = "*"; } if (type == Type.BOOLEAN) error(cntx, "vmm.parser.OperatorRequiresNumerical", opName); Type nextType = parseNumericalFactor(cntx); if (nextType == Type.BOOLEAN) error(cntx, "vmm.parser.OperatorRequiresNumerical", opName); if (type == Type.REAL && nextType == Type.COMPLEX) { cntx.bldr.addStackOp(StackOp.FIRST_OP_TO_COMPLEX); type = Type.COMPLEX; } else if (type == Type.COMPLEX && nextType == Type.REAL) cntx.bldr.addStackOp(StackOp.REAL_TO_COMPLEX); if (type == Type.REAL) cntx.bldr.addStackOp(op == Token.TIMES ? StackOp.TIMES : StackOp.DIVIDE); else cntx.bldr.addStackOp(op == Token.TIMES ? StackOp.C_TIMES : StackOp.C_DIVIDE); } return type; }
@NotNull private static List<PyGenericType> collectGenericTypes( @NotNull PyClass cls, @NotNull Context context) { boolean isGeneric = false; for (PyClass ancestor : cls.getAncestorClasses(context.getTypeContext())) { if (GENERIC_CLASSES.contains(ancestor.getQualifiedName())) { isGeneric = true; break; } } if (isGeneric) { final ArrayList<PyGenericType> results = new ArrayList<>(); // XXX: Requires switching from stub to AST for (PyExpression expr : cls.getSuperClassExpressions()) { if (expr instanceof PySubscriptionExpression) { final PyExpression indexExpr = ((PySubscriptionExpression) expr).getIndexExpression(); if (indexExpr != null) { for (PsiElement resolved : tryResolving(indexExpr, context.getTypeContext())) { final PyGenericType genericType = getGenericType(resolved, context); if (genericType != null) { results.add(genericType); } } } } } return results; } return Collections.emptyList(); }
@Override public void define(Context context) { ImmutableList.Builder<Object> builder = ImmutableList.builder(); Version sonarQubeVersion = context.getSonarQubeVersion(); if (!sonarQubeVersion.isGreaterThanOrEqual(SQ_6_0) || context.getRuntime().getProduct() != SonarProduct.SONARLINT) { builder.addAll(SurefireExtensions.getExtensions()); builder.addAll(JaCoCoExtensions.getExtensions(sonarQubeVersion)); } builder.addAll(JavaClasspathProperties.getProperties()); builder.add( JavaClasspath.class, JavaTestClasspath.class, Java.class, PropertyDefinition.builder(Java.FILE_SUFFIXES_KEY) .defaultValue(Java.DEFAULT_FILE_SUFFIXES) .name("File suffixes") .description( "Comma-separated list of suffixes for files to analyze. To not filter, leave the list empty.") .subCategory("General") .onQualifiers(Qualifiers.PROJECT) .build(), JavaRulesDefinition.class, JavaSonarWayProfile.class, SonarComponents.class, DefaultJavaResourceLocator.class, JavaSquidSensor.class, PostAnalysisIssueFilter.class, XmlFileSensor.class); context.addExtensions(builder.build()); }