Permalink
Browse files

Project Cleanup

  • Loading branch information...
cread committed Dec 2, 2010
1 parent 84fcb04 commit 23bd23c735d4d0dc3286f74b8a616e5e6f241c56
View
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="AntConfiguration">
+ <defaultAnt bundledAnt="true" />
+ </component>
+</project>
+
View
@@ -2,10 +2,7 @@
<project version="4">
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
- <resourceExtensions>
- <entry name=".+\.(properties|xml|html|dtd|tld)" />
- <entry name=".+\.(gif|png|jpeg|jpg)" />
- </resourceExtensions>
+ <resourceExtensions />
<wildcardResourcePatterns>
<entry name="?*.properties" />
<entry name="?*.xml" />
@@ -5,9 +5,11 @@
<root url="jar://$PROJECT_DIR$/../TeamCity/devPackage/runtime-util.jar!/" />
<root url="jar://$PROJECT_DIR$/../TeamCity/devPackage/common-api.jar!/" />
<root url="jar://$PROJECT_DIR$/../TeamCity/devPackage/server-api.jar!/" />
- <root url="jar://$PROJECT_DIR$/../TeamCity/webapps/ROOT/WEB-INF/lib/jdom.jar!/" />
<root url="jar://$PROJECT_DIR$/../TeamCity/webapps/ROOT/WEB-INF/lib/spring.jar!/" />
<root url="jar://$PROJECT_DIR$/../TeamCity/webapps/ROOT/WEB-INF/lib/spring-webmvc.jar!/" />
+ <root url="jar://$PROJECT_DIR$/../TeamCity/webapps/ROOT/WEB-INF/lib/openapi.jar!/" />
+ <root url="jar://$PROJECT_DIR$/../TeamCity/webapps/ROOT/WEB-INF/lib/jdom.jar!/" />
+ <root url="jar://$PROJECT_DIR$/../TeamCity/webapps/ROOT/WEB-INF/lib/util.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
View
@@ -21,10 +21,7 @@
<option name="OPEN_IN_BROWSER" value="true" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_5" assert-keyword="true" jdk-15="true" project-jdk-name="1.6" project-jdk-type="JavaSDK">
- <output url="file://$PROJECT_DIR$/out" />
- </component>
- <component name="SvnBranchConfigurationManager">
- <option name="mySupportsUserInfoFilter" value="true" />
+ <output url="file://out" />
</component>
</project>
View
@@ -2,7 +2,7 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
- <module fileurl="file://$PROJECT_DIR$/tc-hudson.iml" filepath="$PROJECT_DIR$/tc-hudson.iml" />
+ <module fileurl="file://$PROJECT_DIR$/tcjson.iml" filepath="$PROJECT_DIR$/tcjson.iml" />
</modules>
</component>
</project>
View

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -1,5 +1,7 @@
package com.phrydde.teamcity;
+import com.intellij.openapi.diagnostic.Logger;
+import jetbrains.buildServer.messages.Status;
import jetbrains.buildServer.serverSide.ProjectManager;
import jetbrains.buildServer.serverSide.SBuildAgent;
import jetbrains.buildServer.serverSide.SBuildServer;
@@ -12,6 +14,7 @@
import java.util.HashMap;
public class JSONMonitorController implements Controller {
+ final Logger LOG = Logger.getInstance(JSONMonitorController.class.getName());
private final SBuildServer server;
private final ProjectManager projectManager;
@@ -29,10 +32,18 @@ public ModelAndView handleRequest(HttpServletRequest httpServletRequest, HttpSer
modelAndView.addObject("numExecutors", server.getBuildAgentManager().<SBuildAgent>getRegisteredAgents().size());
modelAndView.addObject("projectCount", numberOfProjects);
- HashMap[] projects = new HashMap[numberOfProjects];
+ HashMap projects = new HashMap();
- for (SProject project : projectManager.getProjects()) {
+ for (int i = 0; i < numberOfProjects; i++) {
+ HashMap p = new HashMap();
+ SProject project = projectManager.getProjects().get(i);
System.out.println(" -> project.getName() = " + project.getName());
+ LOG.error(" -> project.getName() = " + project.getName());
+ p.put("name", project.getName());
+ p.put("url", project.getProjectId());
+ p.put("color", project.getStatus());
+
+ projects.put("project-" + String.valueOf(i), p);
}
modelAndView.addObject("projects", projects);
@@ -1,13 +1,17 @@
package com.phrydde.teamcity;
+import com.intellij.openapi.diagnostic.Logger;
import org.springframework.web.servlet.View;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
+import java.util.HashMap;
import java.util.Map;
public class JSONView implements View {
+ final Logger LOG = Logger.getInstance(JSONView.class.getName());
+
public String getContentType() {
return "application/json";
}
@@ -34,6 +38,16 @@ public void render(Map map, HttpServletRequest request, HttpServletResponse resp
.append("\"description\":null,")
.append("\"jobs\":[{");
+ for (int i = 0; i < (Integer)map.get("projectCount"); i++) {
+ HashMap project = (HashMap)map.get("project-" + String.valueOf(i));
+
+ if (project == null) {
+ LOG.error("Got a null project! project-" + String.valueOf(i));
+ }
+ data.append("\"name\":\"").append(project.get("name")).append("\",");
+ data.append("\"url\":\"").append(project.get("url")).append("\",");
+ data.append("\"color\":\"").append(project.get("color")).append("\",");
+ }
// TODO: Loop through and fill this in
// "name":"Broken Build",
// "url":"http://localhost:8080/job/Broken%20Build/",
@@ -16,14 +16,10 @@
public TCJSON(SBuildServer server, ProjectManager projectManager,
WebControllerManager webControllerManager, WebResourcesManager webResourcesManager) {
- LOG.info(" *** TC JSON Starting up *** ");
server.registerExtension(MainConfigProcessor.class, PLUGIN_NAME, this);
webResourcesManager.addPluginResources(PLUGIN_NAME, PLUGIN_NAME + ".jar");
webControllerManager.registerController("/app/json/**", new JSONMonitorController(server, projectManager));
-
-// webControllerManager.getPlaceById(PlaceId.ALL_PAGES_FOOTER).addExtension(new PiazzaLinkPageExtension(this));
- LOG.info(" *** TC JSON Ready ***");
}
public void readFrom(Element element) {

0 comments on commit 23bd23c

Please sign in to comment.