use of org.bimserver.shared.meta.SService in project BIMserver by opensourceBIM.
the class RealtimeReflectorFactoryBuilder method createCreateReflectorMethod1.
private void createCreateReflectorMethod1(CtClass reflectorFactoryImpl) throws NotFoundException, CannotCompileException {
CtClass[] parameters = new CtClass[2];
parameters[0] = pool.get(Class.class.getName());
parameters[1] = pool.get(Reflector.class.getName());
CtMethod method = new CtMethod(pool.get(PublicInterface.class.getName()), "createReflector", parameters, reflectorFactoryImpl);
StringBuilder methodBuilder = new StringBuilder();
methodBuilder.append("{");
methodBuilder.append("if (1==0) {");
for (String name : servicesMap.keySetName()) {
SService sService = servicesMap.getByName(name);
methodBuilder.append("} else if ($1.getSimpleName().equals(\"" + sService.getSimpleName() + "\")) {");
methodBuilder.append("return new " + GENERATED_CLASSES_PACKAGE + "." + sService.getSimpleName() + "Impl" + implementationCounter + "($2);");
}
methodBuilder.append("}");
methodBuilder.append("return null;");
methodBuilder.append("}");
method.setBody(methodBuilder.toString());
reflectorFactoryImpl.addMethod(method);
}
use of org.bimserver.shared.meta.SService in project BIMserver by opensourceBIM.
the class RealtimeReflectorFactoryBuilder method createCreateReflectorMethod2.
private void createCreateReflectorMethod2(CtClass reflectorFactoryImpl) throws NotFoundException, CannotCompileException {
CtClass[] parameters = new CtClass[2];
parameters[0] = pool.get(Class.class.getName());
parameters[1] = pool.get(PublicInterface.class.getName());
CtMethod method = new CtMethod(pool.get(Reflector.class.getName()), "createReflector", parameters, reflectorFactoryImpl);
StringBuilder methodBuilder = new StringBuilder();
methodBuilder.append("{");
methodBuilder.append("if (1==0) {");
for (String name : servicesMap.keySetName()) {
SService sService = servicesMap.getByName(name);
methodBuilder.append("} else if ($1.getSimpleName().equals(\"" + sService.getSimpleName() + "\")) {");
methodBuilder.append("return new " + GENERATED_CLASSES_PACKAGE + "." + sService.getSimpleName() + "Reflector" + implementationCounter + "((" + sService.getInterfaceClass().getName() + ")$2);");
}
methodBuilder.append("}");
methodBuilder.append("return null;");
methodBuilder.append("}");
method.setBody(methodBuilder.toString());
reflectorFactoryImpl.addMethod(method);
}
use of org.bimserver.shared.meta.SService in project BIMserver by opensourceBIM.
the class MetricsRegistry method getMetrics.
public synchronized SMetrics getMetrics() {
SMetrics sMetrics = new SMetrics();
for (SService sService : methodStats.keySet()) {
SInterfaceMetric interfaceMetric = new SInterfaceMetric();
interfaceMetric.setName(sService.getSimpleName());
sMetrics.getInterfaces().add(interfaceMetric);
for (SMethod sMethod : methodStats.get(sService).keySet()) {
SMethodMetric sMethodMetric = new SMethodMetric();
sMethodMetric.setName(sMethod.getName());
interfaceMetric.getMethods().add(sMethodMetric);
MethodStats methodStats = getMethodStats(sMethod);
sMethodMetric.setNrCalls(methodStats.getNrCalls());
sMethodMetric.setAverageMs(methodStats.getAverageNanoSecondsPerCall() / 1000000);
}
}
return sMetrics;
}
use of org.bimserver.shared.meta.SService in project BIMserver by opensourceBIM.
the class InterfaceList method createSServicesMap.
public static SServicesMap createSServicesMap() {
SServicesMap servicesMap = new SServicesMap();
CodeFetcher sourceCodeFetcher = new CodeFetcher();
SService serviceInterface = new SServiceInterfaceService(servicesMap, sourceCodeFetcher, ServiceInterface.class);
servicesMap.add(serviceInterface);
for (Class<? extends PublicInterface> clazz : getInterfaces()) {
if (clazz != ServiceInterface.class) {
servicesMap.add(new SService(servicesMap, sourceCodeFetcher, clazz));
}
}
servicesMap.initialize();
return servicesMap;
}
use of org.bimserver.shared.meta.SService in project BIMserver by opensourceBIM.
the class RealtimeReflectorFactoryBuilder method createCreateReflectorMethod1.
private void createCreateReflectorMethod1(String newClassPrefix, CtClass reflectorFactoryImpl) throws NotFoundException, CannotCompileException {
CtClass[] parameters = new CtClass[2];
parameters[0] = pool.get(Class.class.getName());
parameters[1] = pool.get(Reflector.class.getName());
CtMethod method = new CtMethod(pool.get(PublicInterface.class.getName()), "createReflector", parameters, reflectorFactoryImpl);
StringBuilder methodBuilder = new StringBuilder();
methodBuilder.append("{");
methodBuilder.append("if (1==0) {");
for (String name : servicesMap.keySetName()) {
SService sService = servicesMap.getByName(name);
methodBuilder.append("} else if ($1.getSimpleName().equals(\"" + sService.getSimpleName() + "\")) {");
methodBuilder.append("return new " + GENERATED_CLASSES_PACKAGE + "." + sService.getSimpleName() + "Impl" + newClassPrefix + "($2);");
}
methodBuilder.append("}");
methodBuilder.append("return null;");
methodBuilder.append("}");
method.setBody(methodBuilder.toString());
reflectorFactoryImpl.addMethod(method);
}
Aggregations