Skip to content

Commit

Permalink
Fixed ng-app accordingly and distribution is building
Browse files Browse the repository at this point in the history
  • Loading branch information
IMS94 committed Oct 27, 2018
1 parent 85e33d5 commit fe9d3f2
Show file tree
Hide file tree
Showing 20 changed files with 205 additions and 715 deletions.
61 changes: 61 additions & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,65 @@
<artifactId>libtensorflow_jni</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo>Base: ${project.basedir}</echo>
<echo>User Dir: ${user.dir}</echo>
</tasks>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>exec-npm-install</id>
<phase>generate-sources</phase>
<configuration>
<workingDirectory>${project.basedir}/../ngapp</workingDirectory>
<executable>npm</executable>
<arguments>
<argument>install</argument>
</arguments>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
<execution>
<id>exec-npm-ng-build</id>
<phase>generate-sources</phase>
<configuration>
<workingDirectory>${project.basedir}/../ngapp</workingDirectory>
<executable>ng</executable>
<arguments>
<argument>build</argument>
<argument>--base-href=./</argument>
<argument>--prod</argument>
</arguments>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
26 changes: 13 additions & 13 deletions core/src/main/java/org/augur/sense/web/RestServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,14 @@
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.util.resource.PathResource;
import org.augur.sense.api.annotations.AutoStart;
import org.augur.sense.api.annotations.Mode;
import org.augur.sense.api.config.Startable;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.servlet.ServletContainer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.nio.file.Path;
import java.util.HashSet;
import java.util.Set;
Expand Down Expand Up @@ -98,16 +96,18 @@ private void startRestServer() {
ServletHolder servlet = new ServletHolder(servletContainer);
context.addServlet(servlet, CONTEXT_PATH);

// DefaultServlet defaultServlet = new DefaultServlet();
// ServletHolder servletHolder = new ServletHolder("default", defaultServlet);
// URL path = this.getClass().getClassLoader().getResource("ng");
// try {
// servletHolder.setInitParameter("resourceBase", path.toURI().toASCIIString());
// } catch (URISyntaxException e) {
// logger.error("Error occurred", e);
// }
// servletHolder.setInitParameter("dirAllowed", "true");
// context.addServlet(servletHolder, "/");
/* Adding NG App to a default servlet */
DefaultServlet defaultServlet = new DefaultServlet();
ServletHolder servletHolder = new ServletHolder("default", defaultServlet);
servletHolder.setInitParameter("dirAllowed", "true");
URL path = this.getClass().getClassLoader().getResource("ng");
try {
servletHolder.setInitParameter("resourceBase", path.toURI().toASCIIString());
context.addServlet(servletHolder, "/");
} catch (Exception e) {
logger.error("Error occurred when starting web server", e);
// throw new IllegalStateException("Unable to start web server", e);
}

jettyServer.setHandler(context);
logger.debug("Starting REST server");
Expand Down
14 changes: 14 additions & 0 deletions dist/src/main/assembly/default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,19 @@
</includes>
<fileMode>755</fileMode>
</fileSet>
<fileSet>
<directory>.</directory>
<outputDirectory>logs</outputDirectory>
<excludes>
<exclude>*/**</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>.</directory>
<outputDirectory>run</outputDirectory>
<excludes>
<exclude>*/**</exclude>
</excludes>
</fileSet>
</fileSets>
</assembly>
47 changes: 38 additions & 9 deletions dist/src/main/bin/cramp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,45 @@ done

LIB_DEPS="${CRAMP_HOME}/etc/log4j2.xml:${LIB_DEPS}"

echo "Starting Accumulator ..."
case "$1" in
start)
echo "Starting CRAMP ..."

$JAVA_HOME/bin/java \
-cp ${LIB_DEPS} \
-Ddb.user=${DB_USER} \
-Ddb.password=${DB_PASSWORD} \
-Ddb.jdbc.url=${DB_URL} \
-Dorg.augur.sense.mode=${CRAMP_MODE} \
org.augur.sense.ui.CHASS "$@"
$JAVA_HOME/bin/java \
-cp ${LIB_DEPS} \
-Ddb.user=${DB_USER} \
-Ddb.password=${DB_PASSWORD} \
-Ddb.jdbc.url=${DB_URL} \
-Dorg.augur.sense.mode=${CRAMP_MODE} \
-Dlog4j.configurationFile=${CRAMP_HOME}/etc/log4j2.xml \
org.augur.sense.ui.CHASS "$@" &

echo $! > ${CRAMP_HOME}/run/cramp.pid
echo "STARTED"
sleep 2
;;
stop)
echo -n "Shutting down CRAMP"
kill `cat ${CRAMP_HOME}/run/cramp.pid`
rm -f ${CRAMP_HOME}/run/cramp.pid
echo "OK"
;;
restart)
$0 stop
$0 start
;;
status)
if [ -e ${CRAMP_HOME}/run/cramp.pid ] ; then
pid=`cat ${CRAMP_HOME}/run/cramp.pid`
echo "CRAMP is running with pid: $pid"
else
echo "CRAMP is not running"
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac

echo "FINISHED"
sleep 1
exit 0
19 changes: 19 additions & 0 deletions dist/src/main/resources/etc/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<File name="File" fileName="logs/cramp.log">
<PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level %C{1} - %msg%n"/>
</File>
</Appenders>
<Loggers>
<Logger name="org.eclipse.jetty" level="ERROR">
<AppenderRef ref="File"/>
</Logger>
<Logger name="org.hibernate" level="INFO">
<AppenderRef ref="File"/>
</Logger>
<Root level="DEBUG">
<AppenderRef ref="File"/>
</Root>
</Loggers>
</Configuration>
File renamed without changes.
2 changes: 1 addition & 1 deletion ngapp/.angular-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"apps": [
{
"root": "src",
"outDir": "../resources/ng",
"outDir": "../core/src/main/resources/ng",
"assets": [
"assets",
"favicon.ico"
Expand Down
33 changes: 18 additions & 15 deletions ngapp/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,26 @@ import {FormsModule} from '@angular/forms';
import {HttpClientModule} from '@angular/common/http';
import {BrowserModule} from '@angular/platform-browser';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {CalendarModule, ChartModule, CheckboxModule, RadioButton, SliderModule} from 'primeng/primeng';
import {CalendarModule, ChartModule, CheckboxModule, RadioButtonModule, SliderModule} from 'primeng/primeng';

import {AppComponent} from "./app.component";
import {AppRoutingModule} from "./app-routing.module";
import {DashboardComponent} from "./dashboard/dashboard.component";
import {HeatmapsComponent} from "./heatmaps/heatmaps.component";
import {AppComponent} from './app.component';
import {AppRoutingModule} from './app-routing.module';
import {DashboardComponent} from './dashboard/dashboard.component';
import {HeatmapsComponent} from './heatmaps/heatmaps.component';
import {PeopleCountComponent} from './people-count/people-count.component';
import {PointMappingComponent} from './settings/point-mapping/point-mapping.component';
import {ZonesComponent} from './zones/zones.component';
import {ZoneInfoComponent} from './zones/zone-info/zone-info.component';
import {RealtimeMapComponent} from './realtime-map/realtime-map.component';
import {RealtimeInfoComponent} from './realtime-info/realtime-info.component';
import {TimeBoundMapComponent} from './time-bound-map/time-bound-map.component';
import {PersonStopPointsComponent} from "./person-stop-points/person-stop-points.component";
import {ReIdComponent} from './re-id/re-id.component';
import {PersonStopPointsComponent} from './person-stop-points/person-stop-points.component';
import {TimelineComponent} from './timeline/timeline.component';
import {TimeVelocityDistributionComponent} from './time-velocity-distribution/time-velocity-distribution.component';
import {DirectionRingComponent} from './direction-ring/direction-ring.component';
import {MovementDirectionComponent} from './movement-direction/movement-direction.component';
import {AnalyticsService} from "./services/analytics.service";
import {ConfigService} from "./services/config.service";
import {AnalyticsService} from './services/analytics.service';
import {ConfigService} from './services/config.service';

import {
MatButtonModule,
Expand All @@ -44,9 +43,10 @@ import {ConfigComponent} from './settings/config/config.component';
import {ZonesConfigInfoComponent} from './settings/zones-config/zones-config-info/zones-config-info.component';
import {SuccessMessageComponent} from './helpers/success-message/success-message.component';
import {ZoneUiComponent} from './settings/zones-config/zone-ui/zone-ui.component';
import {ZoneComponent} from "./zones/zone/zone.component";
import {HeatmapComponent} from "./heatmaps/heatmap/heatmap.component";
import {TimeLineComponent} from "./time-bound-map/time-line/time-line.component";
import {ZoneComponent} from './zones/zone/zone.component';
import {HeatmapComponent} from './heatmaps/heatmap/heatmap.component';
import {TimeLineComponent} from './time-bound-map/time-line/time-line.component';
import {HashLocationStrategy, LocationStrategy} from '@angular/common';


@NgModule({
Expand All @@ -68,12 +68,10 @@ import {TimeLineComponent} from "./time-bound-map/time-line/time-line.component"
TimeBoundMapComponent,
TimeLineComponent,
PersonStopPointsComponent,
ReIdComponent,
TimelineComponent,
TimeVelocityDistributionComponent,
DirectionRingComponent,
MovementDirectionComponent,
RadioButton,
ZonesConfigComponent,
ConfigComponent,
ZonesConfigInfoComponent,
Expand All @@ -91,6 +89,7 @@ import {TimeLineComponent} from "./time-bound-map/time-line/time-line.component"
ChartModule,
SliderModule,
MatMenuModule,
RadioButtonModule,
MatSidenavModule,
MatButtonModule,
MatToolbarModule,
Expand All @@ -103,7 +102,11 @@ import {TimeLineComponent} from "./time-bound-map/time-line/time-line.component"
MatChipsModule,
MatSliderModule
],
providers: [AnalyticsService, ConfigService],
providers: [
AnalyticsService,
ConfigService,
{provide: LocationStrategy, useClass: HashLocationStrategy}
],
bootstrap: [AppComponent]
})

Expand Down
4 changes: 2 additions & 2 deletions ngapp/src/app/heatmaps/heatmap/heatmap.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ export class HeatmapComponent implements OnInit, OnDestroy {
this.generateHeatMap();
}

private get from(): number {
get from(): number {
return this.secondRange[0];
}

private get to(): number {
get to(): number {
return this.secondRange[1];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ <h4 class="box-title">Movement Direction Map</h4>
</div>
</div>

<div class="col-md-5 col-sm-12" *ngIf="selectedDataPoint != null; else elseBlock">
<div class="col-md-5 col-sm-12" *ngIf="selectedDataPoint != null;">
<div class="box box-primary box-solid">
<div class="box-header">
<h4 class="box-title">Frequency</h4>
Expand Down
Empty file.
Loading

0 comments on commit fe9d3f2

Please sign in to comment.