-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#58: started work on ZooKeeper packager
- Loading branch information
Showing
6 changed files
with
138 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...ackaging-setup-impl/src/main/groovy/org/pongasoft/glu/packaging/setup/BasePackager.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.pongasoft.glu.packaging.setup | ||
|
||
import org.linkedin.util.io.resource.Resource | ||
import org.linkedin.groovy.util.io.fs.FileSystem | ||
|
||
/** | ||
* @author yan@pongasoft.com */ | ||
public class BasePackager | ||
{ | ||
FileSystem fileSystem | ||
Resource outputFolder | ||
Resource inputPackage | ||
|
||
String getPackageName() | ||
{ | ||
def fileName = inputPackage.filename | ||
if(fileName.endsWith(".tgz")) | ||
return fileName[0..-5] | ||
else | ||
return fileName | ||
} | ||
|
||
Resource copyInputPackage(Resource destination) | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
....packaging-setup-impl/src/main/groovy/org/pongasoft/glu/packaging/setup/SetupUtils.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.pongasoft.glu.packaging.setup | ||
|
||
/** | ||
* Contains a set of utilities methods | ||
* | ||
* @author yan@pongasoft.com */ | ||
public class SetupUtils | ||
{ | ||
static String executeCommand(def cmd) | ||
{ | ||
println cmd | ||
Process process = cmd.execute() | ||
Thread.start { | ||
System.err << process.errorStream | ||
} | ||
Thread.start { | ||
process.outputStream.close() | ||
} | ||
def res = process.text | ||
|
||
if(process.waitFor() != 0) | ||
throw new Exception("error while executing command") | ||
|
||
return res | ||
} | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
...ing-setup-impl/src/main/groovy/org/pongasoft/glu/packaging/setup/ZooKeeperPackager.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.pongasoft.glu.packaging.setup | ||
|
||
import org.linkedin.util.io.resource.Resource | ||
|
||
/** | ||
* @author yan@pongasoft.com */ | ||
public class ZooKeeperPackager extends BasePackager | ||
{ | ||
def zookeperServers = [:] | ||
|
||
Collection<Resource> createPackages() | ||
{ | ||
int serverIndex = 1 | ||
zookeperServers.collect { String host, post -> | ||
createPackage(serverIndex++, host, post.toString() as int) | ||
} | ||
} | ||
|
||
Resource createPackage(int serverIndex, String host, int port) | ||
{ | ||
def newPackageName = "${packageName}-${host}-${port}" | ||
Resource packagePath = outputFolder.createRelative(newPackageName) | ||
return packagePath | ||
} | ||
|
||
} |
Oops, something went wrong.