winter 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,401 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project xmlns="${maven.repo.host}.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3
+
4
+ <organization>
5
+ <name>LiveOps</name>
6
+ <url>http://www.liveops.com</url>
7
+ </organization>
8
+
9
+ <scm>
10
+ <url>https://github.liveops.com/${user}/osgi_sample</url>
11
+ <connection>scm:git:git://git@github.liveops.com:${user}/osgi_sample.git</connection>
12
+ <developerConnection>scm:git:git://git@github.liveops.com:${user}/osgi_sample.git</developerConnection>
13
+ </scm>
14
+
15
+ <properties>
16
+ <maven.repo.host>http://artifactory</maven.repo.host>
17
+ </properties>
18
+
19
+ <modelVersion>1.0.0</modelVersion>
20
+ <groupId>com.liveops.sample</groupId>
21
+ <artifactId>sample</artifactId>
22
+ <version>1.0.0-SNAPSHOT</version>
23
+
24
+ <name>com.liveops.integration.platform</name>
25
+
26
+ <description>LiveOps Integrations Platform</description>
27
+
28
+ <packaging>pom</packaging>
29
+
30
+ <modules>
31
+ <module>sample_bundle</module>
32
+ </modules>
33
+
34
+ <build>
35
+ <plugins>
36
+
37
+ <plugin>
38
+ <artifactId>maven-compiler-plugin</artifactId>
39
+ <version>3.0</version>
40
+ <configuration>
41
+ <source>1.6</source>
42
+ <target>1.6</target>
43
+ </configuration>
44
+ </plugin>
45
+
46
+ <plugin>
47
+ <groupId>org.apache.maven.plugins</groupId>
48
+ <artifactId>maven-source-plugin</artifactId>
49
+ <version>2.2.1</version>
50
+ <executions>
51
+ <execution>
52
+ <goals>
53
+ <goal>jar</goal>
54
+ </goals>
55
+ </execution>
56
+ </executions>
57
+ </plugin>
58
+
59
+ <plugin>
60
+ <groupId>org.apache.felix</groupId>
61
+ <artifactId>maven-scr-plugin</artifactId>
62
+ <version>1.4.4</version>
63
+ <executions>
64
+ <execution>
65
+ <id>generate-scr-scrdescriptor</id>
66
+ <goals>
67
+ <goal>scr</goal>
68
+ </goals>
69
+ </execution>
70
+ </executions>
71
+ </plugin>
72
+
73
+ <plugin>
74
+ <groupId>org.codehaus.mojo</groupId>
75
+ <artifactId>cobertura-maven-plugin</artifactId>
76
+ <version>2.5.1</version>
77
+ <configuration>
78
+ <formats>
79
+ <format>html</format>
80
+ <format>xml</format>
81
+ </formats>
82
+ <check />
83
+ </configuration>
84
+ </plugin>
85
+
86
+ <plugin>
87
+ <groupId>com.google.code.maven-svn-revision-number-plugin</groupId>
88
+ <artifactId>svn-revision-number-maven-plugin</artifactId>
89
+ <version>1.13</version> <!-- please use the latest version -->
90
+ <executions>
91
+ <execution>
92
+ <phase>validate</phase>
93
+ <goals>
94
+ <goal>revision</goal>
95
+ </goals>
96
+ </execution>
97
+ </executions>
98
+ <configuration>
99
+ <entries>
100
+ <entry>
101
+ <prefix>lo.build</prefix>
102
+ </entry>
103
+ </entries>
104
+ </configuration>
105
+ </plugin>
106
+ </plugins>
107
+
108
+ <resources>
109
+ <resource>
110
+ <directory>src/main/resources</directory>
111
+ <filtering>true</filtering>
112
+ <includes>
113
+ <include>**/build_info.properties</include>
114
+ </includes>
115
+ </resource>
116
+ <resource>
117
+ <directory>src/main/resources</directory>
118
+ <filtering>false</filtering>
119
+ <excludes>
120
+ <exclude>**/build_info.properties</exclude>
121
+ </excludes>
122
+ </resource>
123
+ </resources>
124
+
125
+ </build>
126
+
127
+ <reporting>
128
+ <plugins>
129
+ <plugin>
130
+ <groupId>org.codehaus.mojo</groupId>
131
+ <artifactId>surefire-report-maven-plugin</artifactId>
132
+ <version>2.0-beta-1</version>
133
+ <inherited>true</inherited>
134
+ </plugin>
135
+ <plugin>
136
+ <groupId>org.apache.maven.plugins</groupId>
137
+ <artifactId>maven-javadoc-plugin</artifactId>
138
+ <version>2.6.1</version>
139
+ </plugin>
140
+ </plugins>
141
+ </reporting>
142
+
143
+ <dependencies>
144
+ <dependency>
145
+ <groupId>org.osgi</groupId>
146
+ <artifactId>org.osgi.core</artifactId>
147
+ <version>4.3.0</version>
148
+ <scope>provided</scope>
149
+ </dependency>
150
+ <dependency>
151
+ <groupId>org.osgi</groupId>
152
+ <artifactId>org.osgi.compendium</artifactId>
153
+ <version>4.3.0</version>
154
+ <scope>provided</scope>
155
+ </dependency>
156
+ <dependency>
157
+ <groupId>junit</groupId>
158
+ <artifactId>junit</artifactId>
159
+ <version>4.10</version>
160
+ <scope>test</scope>
161
+ </dependency>
162
+ <dependency>
163
+ <groupId>org.powermock</groupId>
164
+ <artifactId>powermock-module-junit4</artifactId>
165
+ <version>1.4.12</version>
166
+ <scope>test</scope>
167
+ </dependency>
168
+ <dependency>
169
+ <groupId>org.powermock</groupId>
170
+ <artifactId>powermock-api-easymock</artifactId>
171
+ <version>1.4.12</version>
172
+ <scope>test</scope>
173
+ </dependency>
174
+ <dependency>
175
+ <groupId>org.easymock</groupId>
176
+ <artifactId>easymock</artifactId>
177
+ <version>3.1</version>
178
+ <scope>test</scope>
179
+ </dependency>
180
+ <dependency>
181
+ <groupId>cglib</groupId>
182
+ <artifactId>cglib-nodep</artifactId>
183
+ <version>2.2</version>
184
+ <scope>test</scope>
185
+ </dependency>
186
+ <dependency>
187
+ <groupId>org.objenesis</groupId>
188
+ <artifactId>objenesis</artifactId>
189
+ <version>1.2</version>
190
+ <scope>test</scope>
191
+ </dependency>
192
+ <dependency>
193
+ <groupId>javassist</groupId>
194
+ <artifactId>javassist</artifactId>
195
+ <version>3.8.0.GA</version>
196
+ <scope>test</scope>
197
+ </dependency>
198
+ </dependencies>
199
+
200
+ <dependencyManagement>
201
+ <dependencies>
202
+ <dependency>
203
+ <groupId>com.liveops.integration</groupId>
204
+ <artifactId>apiservicemanager</artifactId>
205
+ <version>${project.version}</version>
206
+ <scope>provided</scope>
207
+ </dependency>
208
+ <dependency>
209
+ <groupId>com.liveops.integration</groupId>
210
+ <artifactId>bundleconfig</artifactId>
211
+ <version>${project.version}</version>
212
+ <scope>provided</scope>
213
+ </dependency>
214
+ <dependency>
215
+ <groupId>com.liveops.integration</groupId>
216
+ <artifactId>callback</artifactId>
217
+ <version>${project.version}</version>
218
+ <scope>provided</scope>
219
+ </dependency>
220
+ <dependency>
221
+ <groupId>com.liveops.integration</groupId>
222
+ <artifactId>callcenterpipe</artifactId>
223
+ <version>${project.version}</version>
224
+ <scope>provided</scope>
225
+ </dependency>
226
+ <dependency>
227
+ <groupId>com.liveops.integration</groupId>
228
+ <artifactId>config</artifactId>
229
+ <version>${project.version}</version>
230
+ <scope>provided</scope>
231
+ </dependency>
232
+ <dependency>
233
+ <groupId>com.liveops.integration</groupId>
234
+ <artifactId>data</artifactId>
235
+ <version>${project.version}</version>
236
+ <scope>provided</scope>
237
+ </dependency>
238
+ <dependency>
239
+ <groupId>com.liveops.integration</groupId>
240
+ <artifactId>dsm</artifactId>
241
+ <version>${project.version}</version>
242
+ <scope>provided</scope>
243
+ </dependency>
244
+ <dependency>
245
+ <groupId>com.liveops.integration</groupId>
246
+ <artifactId>gnostic</artifactId>
247
+ <version>${project.version}</version>
248
+ <scope>provided</scope>
249
+ </dependency>
250
+ <dependency>
251
+ <groupId>com.liveops.integration</groupId>
252
+ <artifactId>jobscheduler</artifactId>
253
+ <version>${project.version}</version>
254
+ <scope>provided</scope>
255
+ </dependency>
256
+ <dependency>
257
+ <groupId>com.liveops.integration</groupId>
258
+ <artifactId>logger</artifactId>
259
+ <version>${project.version}</version>
260
+ <scope>provided</scope>
261
+ </dependency>
262
+ <dependency>
263
+ <groupId>com.liveops.integration</groupId>
264
+ <artifactId>measureperf</artifactId>
265
+ <version>${project.version}</version>
266
+ <scope>provided</scope>
267
+ </dependency>
268
+ <dependency>
269
+ <groupId>com.liveops.integration</groupId>
270
+ <artifactId>mrlogger</artifactId>
271
+ <version>${project.version}</version>
272
+ <scope>provided</scope>
273
+ </dependency>
274
+ <dependency>
275
+ <groupId>com.liveops.integration</groupId>
276
+ <artifactId>platform_api</artifactId>
277
+ <version>${project.version}</version>
278
+ <scope>provided</scope>
279
+ </dependency>
280
+ <dependency>
281
+ <groupId>com.liveops.integration</groupId>
282
+ <artifactId>presence</artifactId>
283
+ <version>${project.version}</version>
284
+ <scope>provided</scope>
285
+ </dependency>
286
+ <dependency>
287
+ <groupId>com.liveops.integration.platform</groupId>
288
+ <artifactId>resourceid</artifactId>
289
+ <version>${project.version}</version>
290
+ <scope>provided</scope>
291
+ </dependency>
292
+ <dependency>
293
+ <groupId>com.liveops.integration</groupId>
294
+ <artifactId>security</artifactId>
295
+ <version>${project.version}</version>
296
+ <scope>provided</scope>
297
+ </dependency>
298
+ <dependency>
299
+ <groupId>com.liveops.integration</groupId>
300
+ <artifactId>statswatcher</artifactId>
301
+ <version>${project.version}</version>
302
+ <scope>provided</scope>
303
+ </dependency>
304
+ <dependency>
305
+ <groupId>com.liveops.integration</groupId>
306
+ <artifactId>telephony</artifactId>
307
+ <version>${project.version}</version>
308
+ <scope>provided</scope>
309
+ </dependency>
310
+ <dependency>
311
+ <groupId>com.liveops.integration</groupId>
312
+ <artifactId>eventtypes</artifactId>
313
+ <version>${project.version}</version>
314
+ </dependency>
315
+ <dependency>
316
+ <groupId>com.liveops.integration</groupId>
317
+ <artifactId>util</artifactId>
318
+ <version>${project.version}</version>
319
+ </dependency>
320
+
321
+ <dependency>
322
+ <groupId>org.codehaus.jackson</groupId>
323
+ <artifactId>jackson-core-asl</artifactId>
324
+ <version>1.6.1</version>
325
+ <type>jar</type>
326
+ <scope>compile</scope>
327
+ </dependency>
328
+ <dependency>
329
+ <groupId>org.codehaus.jackson</groupId>
330
+ <artifactId>jackson-mapper-asl</artifactId>
331
+ <version>1.6.1</version>
332
+ <type>jar</type>
333
+ <scope>compile</scope>
334
+ </dependency>
335
+ </dependencies>
336
+ </dependencyManagement>
337
+
338
+ <repositories>
339
+ <repository>
340
+ <id>remote-repos</id>
341
+ <name>Remote Repositories</name>
342
+ <url>${maven.repo.host}:8081/artifactory/remote-repos</url>
343
+ </repository>
344
+ <repository>
345
+ <snapshots>
346
+ <enabled>false</enabled>
347
+ </snapshots>
348
+ <id>libs-releases</id>
349
+ <name>maven-releases</name>
350
+ <url>${maven.repo.host}:8081/artifactory/libs-releases</url>
351
+ </repository>
352
+ <repository>
353
+ <releases>
354
+ <enabled>false</enabled>
355
+ </releases>
356
+ <snapshots>
357
+ <enabled>true</enabled>
358
+ </snapshots>
359
+ <id>libs-snapshots</id>
360
+ <name>maven-snapshots</name>
361
+ <url>${maven.repo.host}:8081/artifactory/libs-snapshots</url>
362
+ </repository>
363
+ </repositories>
364
+
365
+ <pluginRepositories>
366
+ <pluginRepository>
367
+ <id>plugins-releases</id>
368
+ <url>${maven.repo.host}:8081/artifactory/plugins-releases</url>
369
+ <releases>
370
+ <enabled>true</enabled>
371
+ </releases>
372
+ <snapshots>
373
+ <enabled>false</enabled>
374
+ </snapshots>
375
+ </pluginRepository>
376
+ <pluginRepository>
377
+ <id>plugins-snapshots</id>
378
+ <url>${maven.repo.host}:8081/artifactory/plugins-snapshots</url>
379
+ <releases>
380
+ <enabled>false</enabled>
381
+ </releases>
382
+ <snapshots>
383
+ <enabled>true</enabled>
384
+ </snapshots>
385
+ </pluginRepository>
386
+ </pluginRepositories>
387
+
388
+ <distributionManagement>
389
+ <repository>
390
+ <id>maven</id>
391
+ <name>maven-releases</name>
392
+ <url>${maven.repo.host}:8081/artifactory/libs-releases-local</url>
393
+ </repository>
394
+ <snapshotRepository>
395
+ <id>maven</id>
396
+ <name>maven-snapshots</name>
397
+ <url>${maven.repo.host}:8081/artifactory/libs-snapshots-local</url>
398
+ </snapshotRepository>
399
+ </distributionManagement>
400
+
401
+ </project>
data/lib/maven_pom.rb ADDED
@@ -0,0 +1,109 @@
1
+ # Copyright 2013 LiveOps, Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License"); you may not
4
+ # use this file except in compliance with the License. You may obtain a copy
5
+ # of the License at:
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
+ # License for the specific language governing permissions and limitations
13
+ # under the License.
14
+
15
+ require 'fileutils'
16
+ require 'net/http'
17
+ require 'ostruct'
18
+ require 'rexml/document'
19
+ require 'rexml/xpath'
20
+ require 'uri'
21
+
22
+ module Winter
23
+ class MavenPom
24
+ class << self
25
+
26
+ def fetch(path, options = {})
27
+ $LOG.debug "Reading POM from #{path}"
28
+ fetch_pom(path, options)
29
+ end
30
+
31
+ def fetch_pom(path, options = {})
32
+ path =~ /^http:\/\// ? fetch_url(path) :
33
+ fetch_file(path)
34
+ end
35
+
36
+ def parse_pom(pom_doc, options = {})
37
+ $LOG.debug "Processing POM"
38
+
39
+ pom = OpenStruct.new
40
+ doc = REXML::Document.new(pom_doc)
41
+
42
+ pom.group = xpath_group(doc)
43
+ pom.artifact = xpath_text(doc, '/project/artifactId')
44
+ pom.version = xpath_text(doc, '/project/version') || xpath_text(doc, '/project/parent/version')
45
+ pom.description = xpath_text(doc, '/project/description')
46
+ pom.url = xpath_text(doc, '/project/url')
47
+ pom.dependencies = xpath_dependencies(doc)
48
+ pom.authors = xpath_authors(doc)
49
+
50
+ pom.name = "#{pom.group}.#{pom.artifact}"
51
+ pom.lib_name = "#{pom.artifact}.rb"
52
+ pom.gem_name = "#{pom.name}-#{pom.version}"
53
+ pom.jar_file = "#{pom.artifact}-#{pom.maven_version}.jar"
54
+ pom.remote_dir = "#{pom.group.gsub('.', '/')}/#{pom.artifact}/#{pom.version}"
55
+ pom
56
+ end
57
+
58
+ private
59
+
60
+ def fetch_url(path)
61
+ Net::HTTP.get(URI.parse(path))
62
+ end
63
+
64
+ def fetch_file(path)
65
+ File.read(path)
66
+ end
67
+
68
+ def xpath_text(element, node)
69
+ first = REXML::XPath.first(element, node) and first.text
70
+ end
71
+
72
+ def xpath_dependencies(element)
73
+ deps = REXML::XPath.first(element, '/project/dependencies')
74
+ pom_dependencies = []
75
+
76
+ if deps
77
+ deps.elements.each do |dep|
78
+ next if xpath_text(dep, 'optional') == 'true'
79
+
80
+ pom_dependencies << {
81
+ :group => xpath_text(dep, 'groupId'),
82
+ :artifact => xpath_text(dep, 'artifactId'),
83
+ :version => xpath_text(dep, 'version'),
84
+ :scope => xpath_text(dep, 'scope')
85
+ }
86
+ end
87
+ end
88
+
89
+ pom_dependencies
90
+ end
91
+
92
+ def xpath_authors(element)
93
+ developers = REXML::XPath.first(element, 'project/developers')
94
+
95
+ authors = if developers
96
+ developers.elements.map do |el|
97
+ xpath_text(el, 'name')
98
+ end
99
+ end || []
100
+ end
101
+
102
+ def xpath_group(element)
103
+ xpath_text(element, '/project/groupId') || xpath_text(element, '/project/parent/groupId')
104
+ end
105
+
106
+ end
107
+ end
108
+ end
109
+
data/lib/winter/cli.rb ADDED
@@ -0,0 +1,89 @@
1
+ # Copyright 2013 LiveOps, Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License"); you may not
4
+ # use this file except in compliance with the License. You may obtain a copy
5
+ # of the License at:
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
+ # License for the specific language governing permissions and limitations
13
+ # under the License.
14
+
15
+ require 'thor'
16
+ #autoload :DSL, 'winter/dsl'
17
+ require 'winter/dsl'
18
+ require 'winter/logger'
19
+ require 'winter/version'
20
+ require 'winter/service/build'
21
+ require 'winter/service/start'
22
+ require 'winter/service/status'
23
+ require 'winter/service/stop'
24
+ require 'winter/service/validate'
25
+
26
+ module Winter
27
+ class CLI < Thor
28
+
29
+ desc "validate [Winterfile]", "(optional) Check the configuration files"
30
+ method_option :group, :desc => "Config group"
31
+ method_option :debug, :desc => "Set log level to debug."
32
+ def validate( winterfile='Winterfile' )
33
+ begin
34
+ $LOG.level = Logger::DEBUG if options[:debug]
35
+ s = Winter::Service.new
36
+ s.validate winterfile, options
37
+ $LOG.info "#{winterfile} is valid."
38
+ rescue Exception=>e
39
+ $LOG.error "#{winterfile} is invalid."
40
+ $LOG.debug e
41
+ end
42
+ end
43
+
44
+ desc "version", "Display version information."
45
+ def version
46
+ $LOG.info VERSION
47
+ end
48
+
49
+ desc "start [Winterfile]", "Start the services in [Winterfile] "
50
+ method_option :group, :desc => "Config group"
51
+ #method_option :verbose, :desc => "Verbose maven output"
52
+ method_option :debug, :desc => "Set log level to debug."
53
+ method_option :console, :desc => "Send console output to [file]",
54
+ :default => "/dev/null", :aliases => "--con"
55
+ def start(winterfile='Winterfile')
56
+ $LOG.level = Logger::DEBUG if options[:debug]
57
+ s = Winter::Service.new
58
+ s.start winterfile, options
59
+ end
60
+
61
+ desc "stop [Winterfile]", "Stop the services in [Winterfile]"
62
+ method_option :group, :desc => "Config group"
63
+ def stop(winterfile='Winterfile')
64
+ s = Winter::Service.new
65
+ s.stop winterfile, options
66
+ end
67
+
68
+ desc "status", "Show status of available services"
69
+ def status
70
+ s = Winter::Service.new
71
+ s.status.each do |service, status|
72
+ $LOG.info " #{service} : #{status}"
73
+ end
74
+ end
75
+
76
+ desc "build [Winterfile]", "Build a service from a Winterfile"
77
+ method_option :group, :desc => "Config group"
78
+ method_option :verbose, :desc => "Verbose maven output"
79
+ method_option :debug, :desc => "Set log level to debug."
80
+ method_option :local, :desc => "Resolve dependencies only from local repository"
81
+ def build( winterfile='Winterfile' )
82
+ $LOG.level = Logger::DEBUG if options[:debug]
83
+ s = Winter::Service.new
84
+ s.build( winterfile, options )
85
+ end
86
+
87
+ end #class
88
+ end #module
89
+
@@ -0,0 +1,32 @@
1
+ # Copyright 2013 LiveOps, Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License"); you may not
4
+ # use this file except in compliance with the License. You may obtain a copy
5
+ # of the License at:
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
+ # License for the specific language governing permissions and limitations
13
+ # under the License.
14
+
15
+
16
+ #@wf_dir =
17
+ WINTERFELL_DIR = ENV['WINTERFELL_DIR'] || '.'
18
+ #RUN_DIR = File.join(WINTERFELL_DIR,"run") || 'run'
19
+
20
+ SERVICES_DIR = "services"
21
+ RUN_DIR = "run"
22
+ BUNDLES_DIR = "bundles"
23
+ LIBS_DIR = "libs"
24
+ DEFAULT_CONF_DIR = "defaults"
25
+ TEMPLATES_DIR = "templates"
26
+ DAEMONTOOLS_DIR = "/service"
27
+ OPT_BUNDLE_DIR = "bundle.dir"
28
+ F_CONFIG_PROPERTIES = "config.properties"
29
+ F_SYSTEM_PROPERTIES = "system.properties"
30
+ F_LOGGER_PROPERTIES = "logger_bundle.properties"
31
+ F_LOG4J_PROPERTIES = "log4j.properties"
32
+ F_LOGBACK_XML = "logback.xml"