public ApplicationName getApplication() { if (StringUtil.isEmpty(appName)) return null; return ApplicationName.valueOf(appName); }
public static ApplicationName applicationName(String host, String context) { StringBuilder id = new StringBuilder(); id.append(sanitize(host)).append(SEPARATOR); id.append(sanitize(context)); return ApplicationName.valueOf(id.toString()); }
protected ApplicationName fromServletContext (ServletContext context) { String path=context.getContextPath(), name=context.getServletContextName(); if (StringUtil.isEmpty(path) || "/".equals(path)) { name = "insight"; } else if (path.charAt(0) == '/') { name = path.substring(1); } else { name = path; } return ApplicationName.valueOf("localhost", name); }
public static final ApplicationName restoreApplicationName(CollectionSettingName name) { if (name == null) { return null; } String key=name.getKey(); if (!StringUtil.isProperPrefix(key, KEY_NAME)) { return null; } if ((key.length() <= (KEY_NAME.length() + 1)) || (key.charAt(KEY_NAME.length()) != '.')) { return null; // make sure followed by '.' and not only '.' } String appName=key.substring(KEY_NAME.length() + 1); return ApplicationName.valueOf(appName); }
public static SyncResourceCommand getApplicationResourceCommand() { ApplicationResource appRes = new ApplicationResource(ApplicationName.valueOf("appName"), "a label"); return new SyncResourceCommand(appRes); }
public static Trace makeTraceTree(String app, String path, String traceId, TestFrameCreator creator) { ApplicationName appKey = ApplicationName.valueOf(app); return Trace.newInstance(appKey, TraceId.valueOf(traceId), makeFrameTree(path, 1, 1000, 3, 3, creator)); }
public static SyncResourceCommand getApplicationEndpointResourceCommand() { ApplicationEndPointResource appEndPointRes = new ApplicationEndPointResource(ApplicationName.valueOf("appName"), EndPointName.valueOf("endPoint"),"a label"); return new SyncResourceCommand(appEndPointRes); }
public static SyncResourceCommand getApplicationServerResourceCommand() { ApplicationServerResource appServerRes = new ApplicationServerResource(ApplicationName.valueOf("appName"), ServerName.valueOf("serverName"), "a label"); return new SyncResourceCommand(appServerRes); }
public static Trace makeTrace(String app, String path, String traceId, TestFrameCreator creator) { ApplicationName appKey = ApplicationName.valueOf(app); return Trace.newInstance(appKey, TraceId.valueOf(traceId), creator.makeFrame(path)); }
public static Trace makeTrace(String app, String path, String traceId, TestFrameCreator creator, long durationMillis) { ApplicationName appKey = ApplicationName.valueOf(app); return Trace.newInstance(appKey, TraceId.valueOf(traceId), creator.makeFrame(path, durationMillis)); }
public static SyncResourceCommand getApplicationServerEndpointResourceCommand() { ApplicationServerEndPointResource appEndPointServerRes = new ApplicationServerEndPointResource(ApplicationName.valueOf("appName"), ServerName.valueOf("myserver"), EndPointName.valueOf("endPoint"),"a label"); return new SyncResourceCommand(appEndPointServerRes); }
public Collection<ResourceKey> findResourcesWithTraces() { Session s = (Session)entityManager.getDelegate(); @SuppressWarnings("unchecked") Collection<Object[]> objs = s.createSQLQuery("SELECT distinct t.EXTERNAL_RESOURCE_NAME, t.EXTERNAL_RESOURCE_SUBTYPE, t.EXTERNAL_RESOURCE_HOST, t.EXTERNAL_RESOURCE_PORT, t.EXTERNAL_RESOURCE_VENDOR, t.EXTERNAL_RESOURCE_IS_INCOMING, t.ENDPOINT_NAME, t.SERVER_NAME, t.APP_NAME FROM TRACE_SUMMARIES t").list(); if (ListUtil.size(objs) <= 0) { return Collections.emptyList(); } Collection<ResourceKey> res = new ArrayList<ResourceKey>(objs.size()); for (Object[] o: objs) { EndPointName epName = EndPointName.valueOf((String)o[6]); ServerName serverName = ServerName.valueOf((String)o[7]); ApplicationName appName = ApplicationName.valueOf((String)o[8]); final ResourceKey k; if (StringUtil.isEmpty((String) o[0])) { k = ApplicationServerEndPointResource.makeKey(appName, serverName, epName); } else { ExternalResourceName extName = ExternalResourceName.valueOf((String)o[0]); String subtype = (String)o[1]; String host = (String)o[2]; String port = String.valueOf(o[3]); String vendor = (String)o[4]; Boolean incoming = (Boolean)o[5]; k = EndpointApplicationServerExternalResource.makeKey(epName, appName, serverName, extName, subtype, vendor, host, port, incoming.booleanValue()); } res.add(k); } return res; } }
public static SyncResourceCommand getExternalResourceCommand() { EndpointApplicationServerExternalResource extern = new EndpointApplicationServerExternalResource( EndPointName.valueOf("FooEndPoint"), ApplicationName.valueOf("FooApplication"), ServerName.valueOf("FooServer"), ExternalResourceName.valueOf("mysql:FooExternalResource"), "mysql:jdbc-subtype", "mysql", "Some sort of fancy label", "127.0.0.1", 8080, "blue", false, null); return new SyncResourceCommand(extern); }
public static ResourceKey makeDestinationKey(String destApp, String destSer, String destEp, TraceSource source) { if (StringUtil.isEmpty(destApp) || StringUtil.isEmpty(destSer) || StringUtil.isEmpty(destEp)) { return null; } return ApplicationServerEndPointResource.makeKey(ApplicationName.valueOf(destApp), ServerName.valueOf(destSer), EndPointName.valueOf(destEp), source); }
@Override public ApplicationName deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { String name=null; // NOTE: the field names must be coordinated with the serializer while (jp.nextToken() != JsonToken.END_OBJECT) { String fieldName = jp.getCurrentName(); jp.nextToken(); if ("name".equals(fieldName)) { name = getStringValue(jp, fieldName, name); } else { // allow extra data - ignore it (older versions compatibility) continue; // debug breakpoint } } if (StringUtil.isEmpty(name)) { throw new JsonParseException("No application name provided", jp.getCurrentLocation()); } return ApplicationName.valueOf(name); } }