rsanchez
2015-07-17 0a02bb7acd7e893197aa82f297c14f113d4666dd
#0 fix - Fixed Lic Type Metadata JPA annotation
1 files deleted
1 files modified
changed files
securis/src/main/java/net/curisit/securis/SeCurisServer.java patch | view | blame | history
securis/src/main/java/net/curisit/securis/db/LicenseTypeMetadata.java patch | view | blame | history
securis/src/main/java/net/curisit/securis/SeCurisServer.java
deleted file mode 100644
....@@ -1,219 +0,0 @@
1
-package net.curisit.securis;
2
-
3
-import org.apache.logging.log4j.LogManager;
4
-import org.apache.logging.log4j.Logger;
5
-
6
-public class SeCurisServer {
7
-
8
- private static final Logger LOG = LogManager.getLogger(SeCurisServer.class);
9
- private static final Logger CONSOLE = LogManager.getLogger("console");
10
- //
11
- // private static final String PID_FILE = System.getProperty("user.home") +
12
- // "/.SeCuris/securis-server.pid";
13
- //
14
- // private static Server server;
15
- // private static Injector injector = null;
16
- //
17
- // @Inject
18
- // @Named("base-uri")
19
- // private URI uri;
20
- //
21
- // private static void showHelp() {
22
- // CONSOLE.info("Execute SeCuris server using:");
23
- // CONSOLE.info(" $ ./securis-server.sh {start|stop}");
24
- // }
25
- //
26
- // public static void main(String[] args) throws Exception {
27
- // String command;
28
- // if (args.length > 0) {
29
- // command = args[0].toLowerCase();
30
- // } else {
31
- // command = "start";
32
- // }
33
- //
34
- // switch (command) {
35
- // case "start":
36
- // startServer();
37
- // break;
38
- // case "stop":
39
- // stopServer();
40
- // break;
41
- //
42
- // default:
43
- // showHelp();
44
- // System.exit(-1);
45
- // }
46
- // }
47
- //
48
- // private static void stopServer() {
49
- // if (!new File(PID_FILE).exists()) {
50
- // CONSOLE.error("SeCuris server is NOT running or PID file is missing");
51
- // System.exit(-3);
52
- // }
53
- // try {
54
- // int pid = Integer.parseInt(FileUtils.readFileToString(new
55
- // File(PID_FILE)));
56
- // Runtime.getRuntime().exec("kill -SIGINT " + pid);
57
- // new File(PID_FILE).delete();
58
- // CONSOLE.info("SeCuris server process stopped sucessfully (PID: {})",
59
- // pid);
60
- // } catch (NumberFormatException | IOException e) {
61
- // LOG.error("Error getting SeCuris server process PID from file: {}",
62
- // PID_FILE);
63
- // }
64
- // }
65
- //
66
- // private static void startServer() {
67
- //
68
- // if (new File(PID_FILE).exists()) {
69
- // try {
70
- // CONSOLE.error("SeCuris server is already running with PID: {}",
71
- // FileUtils.readFileToString(new File(PID_FILE)));
72
- // } catch (IOException e) {
73
- // LOG.error("Unexpected error", e);
74
- // }
75
- // System.exit(-2);
76
- // }
77
- //
78
- // SecurisModule securisModule = new SecurisModule();
79
- // JpaPersistModule jpaPersistModule = new JpaPersistModule("localdb");
80
- // Properties props = new Properties();
81
- // props.put("javax.persistence.jdbc.password",
82
- // securisModule.getPassword());
83
- // props.put("javax.persistence.jdbc.url",
84
- // securisModule.getUrl(securisModule.getAppDir()));
85
- // // LOG.info("BD Url: {} {}",
86
- // // securisModule.getUrl(securisModule.getAppDir()),
87
- // // securisModule.getPassword());
88
- // jpaPersistModule.properties(props);
89
- //
90
- // injector = Guice.createInjector(securisModule, new RequestsModule(),
91
- // jpaPersistModule);
92
- //
93
- // try {
94
- // startServer(injector.getInstance(Key.get(URI.class,
95
- // Names.named("base-uri"))));
96
- //
97
- // } catch (SeCurisException e) {
98
- // CONSOLE.error("Error launching the SeCuris server, {}", e);
99
- // }
100
- // }
101
- //
102
- // private static void savePID() throws SeCurisException {
103
- // String runtimeName = ManagementFactory.getRuntimeMXBean().getName();
104
- // // runtimeName contains something like: "12345@localhost"
105
- // String pid = runtimeName.substring(0, runtimeName.indexOf('@'));
106
- // try {
107
- // FileUtils.writeStringToFile(new File(PID_FILE), pid);
108
- // CONSOLE.info("SeCuris server process started sucessfully (PID: {})",
109
- // pid);
110
- // } catch (IOException e) {
111
- // LOG.error("Error saving pid file", e);
112
- // throw new SeCurisException("Error saving pid file");
113
- // }
114
- // }
115
- //
116
- // private static void startServer(URI uri) throws SeCurisException {
117
- // System.out.println("Starting jetty...");
118
- //
119
- // QueuedThreadPool threadPool = new QueuedThreadPool();
120
- // threadPool.setMaxThreads(50);
121
- //
122
- // server = new Server();
123
- //
124
- // ServerConnector httpConnector = new ServerConnector(server);
125
- // httpConnector.setPort(Config.getInt(Config.KEYS.SERVER_PORT, 9080));
126
- // httpConnector.setHost(Config.get(Config.KEYS.SERVER_HOSTNAME,
127
- // "0.0.0.0"));
128
- // server.addConnector(httpConnector);
129
- //
130
- // ServletContextHandler context = new
131
- // ServletContextHandler(ServletContextHandler.SESSIONS);
132
- // context.setContextPath("/");
133
- // context.addEventListener(injector.getInstance(GuiceResteasyBootstrapServletContextListener.class));
134
- //
135
- // context.setInitParameter("resteasy.role.based.security", "true");
136
- // context.setInitParameter("resteasy.providers",
137
- // DefaultExceptionHandler.class.getName());
138
- // context.addFilter(new
139
- // FilterHolder(injector.getInstance(PersistFilter.class)), "/*", null);
140
- // ServletHolder sh = new ServletHolder(HttpServletDispatcher.class);
141
- // sh.setName("resteasy");
142
- // context.addServlet(sh, "/*");
143
- //
144
- // ResourceHandler staticResources = new ResourceHandler();
145
- // try {
146
- // staticResources.setBaseResource(Resource.newResource(SeCurisServer.class.getResource("/static").toURI()));
147
- // } catch (IOException | URISyntaxException e) {
148
- // LOG.error("Error configuring static resources", e);
149
- // throw new SeCurisException("Error configuring static resources");
150
- // }
151
- // staticResources.setWelcomeFiles(new String[] {
152
- // "/main.html"
153
- // });
154
- // context.setHandler(staticResources);
155
- //
156
- // ErrorPageErrorHandler errorHandler = new ErrorPageErrorHandler();
157
- // context.setErrorHandler(errorHandler);
158
- // ContextHandlerCollection contexts = new ContextHandlerCollection();
159
- //
160
- // contexts.setHandlers(new Handler[] {
161
- // staticResources, context
162
- // });
163
- //
164
- // HttpConfiguration http_config = new HttpConfiguration();
165
- // http_config.setSecureScheme("https");
166
- // http_config.setSecurePort(Config.getInt(Config.KEYS.SERVER_SSL_PORT,
167
- // 9443));
168
- // http_config.setOutputBufferSize(32768);
169
- // http_config.setSendServerVersion(true);
170
- // http_config.setSendDateHeader(false);
171
- //
172
- // HttpConfiguration https_config = new HttpConfiguration(http_config);
173
- // https_config.addCustomizer(new SecureRequestCustomizer());
174
- //
175
- // SslContextFactory sslContextFactory = new SslContextFactory();
176
- // sslContextFactory.setKeyStorePath(Config.get(Config.KEYS.KEYSTORE_PATH));
177
- // sslContextFactory.setKeyStoreType(Config.get(Config.KEYS.KEYSTORE_TYPE,
178
- // "JKS"));
179
- // sslContextFactory.setKeyStorePassword(Config.get(Config.KEYS.KEYSTORE_PASSWORD,
180
- // ""));
181
- // // sslContextFactory.setCertAlias("1");
182
- // // sslContextFactory.setKeyManagerPassword("curist3c");
183
- // // sslContextFactory.setTrustStorePath("/Users/rob/.ssh/keys/keystore");
184
- // // sslContextFactory.setTrustStorePassword("curist3c");
185
- // sslContextFactory.checkKeyStore();
186
- // sslContextFactory.setNeedClientAuth(false);
187
- //
188
- // ServerConnector sslConnector = new ServerConnector(server, new
189
- // SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()),
190
- // new HttpConnectionFactory(https_config));
191
- // sslConnector.setPort(Config.getInt(Config.KEYS.SERVER_SSL_PORT, 9443));
192
- // sslConnector.setHost(Config.get(Config.KEYS.SERVER_HOSTNAME, "0.0.0.0"));
193
- // server.addConnector(sslConnector);
194
- //
195
- // server.setHandler(context);
196
- // server.setStopAtShutdown(true);
197
- // server.addLifeCycleListener(new ServerStoppedListener());
198
- // try {
199
- // server.start();
200
- // savePID();
201
- // CONSOLE.info("Server running in: {}", String.format("http://%s:%d",
202
- // httpConnector.getHost(), httpConnector.getPort()));
203
- // server.join();
204
- // } catch (Exception e) {
205
- // LOG.error("Error starting SeCurisServer", e);
206
- // throw new SeCurisException("Error starting SeCurisServer");
207
- // }
208
- //
209
- // }
210
- //
211
- // static class ServerStoppedListener extends AbstractLifeCycleListener {
212
- // @Override
213
- // public void lifeCycleStopped(LifeCycle event) {
214
- // if (new File(PID_FILE).exists())
215
- // new File(PID_FILE).delete();
216
- // }
217
- // }
218
-
219
-}
securis/src/main/java/net/curisit/securis/db/LicenseTypeMetadata.java
....@@ -13,7 +13,6 @@
1313
1414 import com.fasterxml.jackson.annotation.JsonAutoDetect;
1515 import com.fasterxml.jackson.annotation.JsonBackReference;
16
-import com.fasterxml.jackson.annotation.JsonIgnore;
1716 import com.fasterxml.jackson.annotation.JsonInclude;
1817 import com.fasterxml.jackson.annotation.JsonInclude.Include;
1918
....@@ -32,11 +31,10 @@
3231
3332 private static final long serialVersionUID = 1L;
3433
35
- @JsonIgnore
3634 @Id
3735 @ManyToOne
38
- @JoinColumn(name = "license_type_id")
3936 @JsonBackReference
37
+ @JoinColumn(name = "license_type_id")
4038 private LicenseType licenseType;
4139
4240 @Id