id
stringlengths
36
36
text
stringlengths
1
1.25M
b496de8f-eb41-4818-b416-8d7b21239ce6
public float getMinimalOsVersion() { return minimalOsVersion; }
a7ffba2e-a4c4-42ca-a942-57e509d968cf
public void setMinimalOsVersion(final float minimalOsVersion) { this.minimalOsVersion = minimalOsVersion; }
7a01b148-33a8-49d4-8419-8ffe389e7ae7
public int getWarningLevelThreshold() { return warningLevelThreshold; }
65efc3a9-4144-428e-ba3f-a3afe0c87354
public void setWarningLevelThreshold(final int warningLevelThreshold) { this.warningLevelThreshold = warningLevelThreshold; }
88be94c3-f686-4f51-b401-9b48f235b7a3
public File getCompatibilityExceptionsFile() { return compatibilityExceptionsFile; }
d7ddb6d4-256c-4b01-9e5f-f1b3dd8f828b
public void setCompatibilityExceptionsFile(final File compatibilityExceptionsFile) { this.compatibilityExceptionsFile = compatibilityExceptionsFile; }
ae9420c4-d6c0-4012-9190-f52f698eee8a
public String getApplicationCategory() { return applicationCategory; }
c0bee4e3-cd06-4164-a897-96c05c7b538a
public void setApplicationCategory(final String applicationCategory) { this.applicationCategory = applicationCategory; }
d6478aa5-4d9c-4229-ae66-d04fb94723ca
public boolean isVerifyApk() { return verifyApk; }
2d078670-8f42-451b-82db-0dcc4244d0b4
public void setVerifyApk(final boolean verifyApk) { this.verifyApk = verifyApk; }
d958aa61-200c-4fdc-8ca0-e128119dfde4
public String getAppEntryPointNameTruncation() { return appEntryPointNameTruncation; }
38e2097c-63f9-49dd-bb5d-15fb5f2af5b8
public void setAppEntryPointNameTruncation(final String appEntryPointNameTruncation) { this.appEntryPointNameTruncation = appEntryPointNameTruncation; }
c2bca722-60ac-4854-bbe1-94371f1c02d8
@Override public String toString() { return "APK file: " + (getApkFile() == null ? null : getApkFile().getPath()) + ", BAR file: " + (getBarFile() == null ? null : getBarFile().getPath()) + ", minimal OS version: " + getMinimalOsVersion() + ", warning level threshold: " + getWarningLevelThreshold() + ", compatibility exceptions file: " + (getCompatibilityExceptionsFile() == null ? null : getCompatibilityExceptionsFile().getPath()) + ", application category: " + getApplicationCategory() + ", verify APK: " + isVerifyApk() + ", app entry point name truncation: " + getAppEntryPointNameTruncation(); }
994852ba-327a-483f-aeb4-0509e13582c0
public SignerArgumentsBuilder(File certificateFile, String password, File keyStoreFile, File bar) throws MojoExecutionException { setCertificateFile(certificateFile); setPassword(password); setKeyStoreFile(keyStoreFile); setBarFile(bar); }
5b376a8f-a48f-4aa5-bb43-5ef6af4cb5d7
public String[] create() { ArrayList<String> args = new ArrayList<String>(); args.add("-bbidtoken"); args.add(getCertificateFile().getPath()); args.add("-keystore"); args.add(getKeyStoreFile().getPath()); args.add("-storepass"); args.add(getPassword()); args.add(getBarFile().getPath()); return args.toArray(new String[args.size()]); }
3a0b2242-b0f9-4479-91ec-139713279acf
public File getCertificateFile() { return certificateFile; }
d9fda4d8-4f4b-41d6-8ff2-901befb1d793
public SignerArgumentsBuilder setCertificateFile(final File certificateFile) throws MojoExecutionException { if (certificateFile == null || !certificateFile.exists()) { throw new MojoExecutionException("Certificate is not specified or does not exist."); } else if (!certificateFile.isFile() || !certificateFile.canRead()) { throw new MojoExecutionException("Certificate is not a file or cannot be read."); } this.certificateFile = certificateFile; return this; }
4486fd59-3aea-4e8c-b66b-ed561625c2ec
public String getPassword() { return password; }
697e4987-3bbb-4cba-b109-04bf4bf54155
public SignerArgumentsBuilder setPassword(final String password) throws MojoExecutionException { if (password == null) { throw new MojoExecutionException("Certificate password must be specified."); } this.password = password; return this; }
81e23ec6-4773-4549-87a3-e7cf9b4ab4b8
public File getKeyStoreFile() { return keyStoreFile; }
f09eb54c-ba49-4c70-a82c-c3a716d3619e
public SignerArgumentsBuilder setKeyStoreFile(final File keyStoreFile) throws MojoExecutionException { if (keyStoreFile == null || !keyStoreFile.exists()) { throw new MojoExecutionException("Key store is not specified or does not exist."); } else if (!keyStoreFile.isFile() || !keyStoreFile.canRead()) { throw new MojoExecutionException("Key store is not a file or cannot be read."); } this.keyStoreFile = keyStoreFile; return this; }
569a6309-02f2-4860-a0e3-317634545d3a
public File getBarFile() { return barFile; }
d27d6395-fc37-473e-afd4-cf7647700c04
public SignerArgumentsBuilder setBarFile(final File barFile) throws MojoExecutionException { if (barFile == null || !barFile.exists()) { throw new MojoExecutionException("Key store is not specified or does not exist."); } else if (!barFile.isFile() || !barFile.canWrite()) { throw new MojoExecutionException("Key store is not a file or no permission to write."); } this.barFile = barFile; return this; }
bffcfb2a-a810-4bfd-9a52-ba453b11255f
public File getFile() { return file; }
d117ee87-c673-4510-9840-994d99360d48
public void setFile(final File file) { this.file = file; }
7173f866-c408-4b13-9034-fb55a8ddf8b4
@Override public String toString() { return "Path: " + (getFile() == null ? null : getFile().getPath()); }
ad595c57-9e41-4efa-b49c-b1353818306c
public File getFile() { return file; }
98a54a3f-aa50-4354-9bbb-c54c56c330b5
public void setFile(final File file) { this.file = file; }
61ecc3ae-7560-435d-93e4-80aa69320e31
public String getPassword() { return password; }
ac8363d6-3306-4a0f-9993-b33865a6b7d7
public void setPassword(final String password) { this.password = password; }
a1adc36e-8d8b-4989-b19d-13e2a1a87156
public String getAuthor() { return author; }
156abe28-acb4-4ba4-9e80-8c93317885be
public void setAuthor(final String author) { this.author = author; }
76d9d14c-4a84-4fed-8fd7-87a66ea3995c
@Override public String toString() { return "Path: " + (getFile() == null ? null : getFile().getPath()) + ", password: " + getPassword() + ", author: " + getAuthor(); }
3b01c0db-9a04-4c20-903b-c62c10347416
public KeyToolArgumentsBuilder(File keyStorageFile, String password, String author) throws MojoExecutionException { setKeyStorageFile(keyStorageFile); setPassword(password); setAuthor(author); }
a63772ac-4058-49bd-97df-8cc4f1b5d1e5
public String[] create() { ArrayList<String> args = new ArrayList<String>(); args.add("-genkeypair"); args.add("-keystore"); args.add(getKeyStorageFile().getPath()); args.add("-storepass"); args.add(getPassword()); args.add("-author"); args.add(getAuthor()); return args.toArray(new String[args.size()]); }
1170d01c-45c8-4258-b3d8-bc72105f1040
public File getKeyStorageFile() { return keyStorageFile; }
4519345f-83bb-4a16-b32c-659e1521145d
public KeyToolArgumentsBuilder setKeyStorageFile(final File keyStorageFile) throws MojoExecutionException { if (keyStorageFile == null) { throw new MojoExecutionException("Key storage file was not specified."); } else if (!keyStorageFile.getParentFile().canWrite()) { throw new MojoExecutionException("No permission to write for parent directory of specified key storage file."); } this.keyStorageFile = keyStorageFile; return this; }
6dfc641f-3d78-433c-a17c-ce27ffc6ea31
public String getPassword() { return password; }
1b2e06cc-f66c-402d-a97c-d90a62891f97
public KeyToolArgumentsBuilder setPassword(final String password) throws MojoExecutionException { if (password == null) { throw new MojoExecutionException("Certificate password must be specified."); } this.password = password; return this; }
a2f103af-5983-4550-82d2-7647383074a4
public String getAuthor() { return author; }
1cac0f26-347f-4490-9fc2-1ac4a85b4886
public KeyToolArgumentsBuilder setAuthor(final String author) throws MojoExecutionException { if (author == null) { throw new MojoExecutionException("Author was not specified."); } this.author = author; return this; }
745e87a2-0681-4aaa-86c6-5ba8c9d3ceb8
@Override protected void doExecute() throws MojoExecutionException, MojoFailureException { verifyPackage(); }
e3887d50-7ac6-4762-a655-6e69db3fa9c2
protected boolean verifyPackage() throws MojoExecutionException { getLog().info("Verifying package..."); if (getBarPackage().getBarFile() == null || !getBarPackage().getBarFile().exists() || !getBarPackage().getBarFile().canRead()) { throw new MojoExecutionException("BAR package was not specified or doesn't " + "exist, or there is no permission to read."); } final String[] args = {"-verify", getBarPackage().getBarFile().getPath()}; Callable<Void> signerCallable = new Callable<Void>() { @Override public Void call() throws Exception { BarSigner.main(args); return null; } }; ExitTrappingExecutor executor = new ExitTrappingExecutor(); boolean signingSuccessful = executor.execute(signerCallable) == 0; getLog().info("Verification complete."); return signingSuccessful; }
132c3f51-b578-4797-bf06-8bd8ee1a5e72
@Override public Void call() throws Exception { BarSigner.main(args); return null; }
c9a073aa-4cd7-4343-9dbe-cf7b87b55381
@Override public void doExecute() throws MojoExecutionException, MojoFailureException { checkBarFile(); checkCertificateFile(); if (createKeyStorage()) { signPackage(); } }
972a67a1-f85a-407d-a3fc-aaf427a21588
protected boolean createKeyStorage() throws MojoExecutionException { getLog().info("Creating key storage..."); getLog().info("Key storage: " + getKeyStorage()); KeyToolArgumentsBuilder argumentsBuilder = new KeyToolArgumentsBuilder(getKeyStorage().getFile(), getCertificate().getPassword(), getCertificate().getAuthor()); final String[] args = argumentsBuilder.create(); Callable<Void> keyStorageCallable = new Callable<Void>() { @Override public Void call() throws Exception { KeyTool.main(args); return null; } }; ExitTrappingExecutor executor = new ExitTrappingExecutor(); boolean keyStorageCreationSuccessful = executor.execute(keyStorageCallable) == 0 && getKeyStorage().getFile().exists(); if (!keyStorageCreationSuccessful) { throw new MojoExecutionException("Failed to create a key storage. Path: " + getKeyStorage().getFile().getPath()); } getLog().info("Key storage successfully created."); return keyStorageCreationSuccessful; }
bb58344d-ce9d-424e-9975-b030745e120e
@Override public Void call() throws Exception { KeyTool.main(args); return null; }
f0dac259-f931-493c-8841-0f5f3079cd2a
protected boolean signPackage() throws MojoExecutionException { getLog().info("Signing package..."); getLog().info("Certificate: " + getKeyStorage()); SignerArgumentsBuilder argumentsBuilder = new SignerArgumentsBuilder(getCertificate().getFile(), getCertificate().getPassword(), getKeyStorage().getFile(), getBarPackage().getBarFile()); final String[] args = argumentsBuilder.create(); Callable<Void> signerCallable = new Callable<Void>() { @Override public Void call() throws Exception { BarSigner.main(args); return null; } }; ExitTrappingExecutor executor = new ExitTrappingExecutor(); boolean signingSuccessful = executor.execute(signerCallable) == 0; getLog().info(signingSuccessful ? "Package signed successfully." : "Package signing failed."); return signingSuccessful; }
a79a8f0c-0795-4fbb-a702-d79bb4da065f
@Override public Void call() throws Exception { BarSigner.main(args); return null; }
46aa9fb4-878e-4354-a452-9c92e9ce02b2
private void checkBarFile() throws MojoExecutionException { if (getBarPackage().getBarFile() == null || !getBarPackage().getBarFile().exists() || !getBarPackage().getBarFile().canWrite()) { throw new MojoExecutionException("BAR package was not specified or doesn't " + "exist, or there is no permission to write."); } }
b5c711dc-63dc-42ec-ac38-82231c404562
private void checkCertificateFile() throws MojoExecutionException { if (getCertificate().getFile() == null || !getCertificate().getFile().exists() || !getCertificate().getFile().canRead()) { throw new MojoExecutionException("Certificate was not specified or doesn't " + "exist, or there is no permission to read."); } }
e9f06b08-e90d-4981-97f4-2c509bf96dcf
@Override public void doExecute() throws MojoExecutionException, MojoFailureException { packageApplication(); }
8e4bdcfa-bca4-4df2-b8ca-ba890c445a2a
protected boolean packageApplication() throws MojoExecutionException { getLog().info("Packaging application..."); getLog().info("BAR package: " + getKeyStorage()); PackagerArgumentsBuilder argumentsBuilder = new PackagerArgumentsBuilder(getBarPackage().getApkFile(), getBarPackage().getBarFile(), getCertificate().getAuthor(), AppCategory.parseCategory(getBarPackage().getApplicationCategory())); argumentsBuilder.setMinimalOsVersion(getBarPackage().getMinimalOsVersion()); argumentsBuilder.setVerifyApk(true); argumentsBuilder.setAppEntryPointNameTruncation(getBarPackage().getAppEntryPointNameTruncation()); argumentsBuilder.setWarningLevelThreshold(getBarPackage().getWarningLevelThreshold()); final String[] args = argumentsBuilder.create(); Callable<Void> packagingCallable = new Callable<Void>() { @Override public Void call() throws Exception { Apk2Bar.main(args); return null; } }; ExitTrappingExecutor executor = new ExitTrappingExecutor(); boolean packagingSuccessful = executor.execute(packagingCallable) == 0 && checkPackage(); if (!packagingSuccessful) { throw new MojoExecutionException("Failed to package application. Path: " + getBarPackage().getBarFile().getPath()); } getLog().info("Application packaged successfully."); return packagingSuccessful; }
a744812f-41a0-42e7-b37a-d11c49e043d0
@Override public Void call() throws Exception { Apk2Bar.main(args); return null; }
cc1f347f-01a2-43b0-bff9-6e011988cf8c
private boolean checkPackage() { if (getBarPackage().getApkFile() == null || !getBarPackage().getApkFile().canRead()) { getLog().error("APK file is not specified or cannot be read."); return false; } String apkName = getBarPackage().getApkFile().getName(); if (getBarPackage().getBarFile() == null) { getLog().error("BAR file is not specified."); return false; } File currentBarFile = new File(getBarPackage().getBarFile().getParent(), apkName.replace(".apk", ".bar")); if (!currentBarFile.exists()) { getLog().error("BAR file does not exist."); return false; } File desirableBarFile = getBarPackage().getBarFile(); if (currentBarFile.getPath().equals(desirableBarFile.getPath())) { // APK file name matches BAR file name, no need to rename. return true; } if (!currentBarFile.canWrite()) { getLog().error("BAR file does not exist or no permission to write."); return false; } // If a file with such name already exists, try to delete it. if (desirableBarFile.exists() && !desirableBarFile.delete()) { getLog().error("Failed to delete existing BAR file with desirable " + "name. Path: " + desirableBarFile.getPath()); return false; } return currentBarFile.renameTo(desirableBarFile); }
00877f10-fb9f-42b1-8450-9642edb4a478
@Override public final void execute() throws MojoExecutionException, MojoFailureException { if (!isSkip()) { doExecute(); } }
0cc2d644-dd56-400d-bcb7-5312e15d8868
protected abstract void doExecute() throws MojoExecutionException, MojoFailureException;
e57a9e05-62e5-42ca-a813-96ad511a741f
public Package getBarPackage() { return barPackage; }
f4e25bf1-c7ca-4a1f-9d7a-d0dc8ffbb63f
public void setBarPackage(final Package barPackage) { this.barPackage = barPackage; }
46a3f5e7-f7bc-409f-8cea-1033131046c6
public Certificate getCertificate() { return certificate; }
cf6dba99-7c85-4aa4-8b31-3288b539ee55
public void setCertificate(final Certificate certificate) { this.certificate = certificate; }
5355b01e-33f9-482e-916f-46672c08f364
public KeyStorage getKeyStorage() { return keyStorage; }
15371545-16c1-41f9-993f-1f2e03c2138a
public void setKeyStorage(final KeyStorage keyStorage) { this.keyStorage = keyStorage; }
a16dca91-f459-4c06-9a56-71a9279e3a31
public boolean isSkip() { return skip; }
4d867e35-7e75-42f1-b409-b1a5e69d830d
public void setSkip(final boolean skip) { this.skip = skip; }
dac33afa-b08e-43e7-810a-05775165c33b
public Endereco() { //inicializando objetos que possuem relacionamento this.cidade = new Cidade(); this.estado = new Estado(); this.tipoLogradouro = new TipoLogradouro(); this.tipoEndereco = new TipoEndereco(); this.pessoa = new Pessoa(); }
88d97490-a3ec-4f53-948b-bdc977515c84
public Integer getIdEndereco() { return idEndereco; }
891bec68-8c1c-4a79-82d5-c3ae28939034
public void setIdEndereco(Integer idEndereco) { this.idEndereco = idEndereco; }
5fd219bb-b9c7-4797-a704-b450a1a22183
public String getBairro() { return bairro; }
ae04e571-70d5-4bcf-998d-1800f61d275d
public void setBairro(String bairro) { this.bairro = bairro; }
a12fc49a-bae4-468c-8191-4cd029454b5f
public String getNomeLogradouro() { return nomeLogradouro; }
029a7d05-0699-444d-a47b-dcf3d26d0b24
public void setNomeLogradouro(String nomeLogradouro) { this.nomeLogradouro = nomeLogradouro; }
0740defd-451d-41d5-b528-ada025d9bd22
public String getCep() { return cep; }
e2ec5411-2d54-432d-9b29-89b1da2a8368
public void setCep(String cep) { this.cep = cep; }
c3dcbe0d-9dab-4373-8ad0-491395dd2f2f
public Integer getNumero() { return numero; }
79aa4d81-c78d-4f47-9d4d-0a9cba210694
public void setNumero(Integer numero) { this.numero = numero; }
784d2414-c395-406d-8c1a-7b36f0e6aea0
public Integer getComplemento() { return complemento; }
ffa817fb-041f-43ed-a184-3afb92e12c2e
public void setComplemento(Integer complemento) { this.complemento = complemento; }
aed77972-db19-473e-bf9b-8a461081b284
public Pessoa getPessoa() { return pessoa; }
be525f4a-0d58-4e96-85fb-8bf8a3dda696
public void setPessoa(Pessoa pessoa) { this.pessoa = pessoa; }
f7b56e5f-e97b-4c19-a3d6-0161eaf4113c
public TipoLogradouro getTipoLogradouro() { return tipoLogradouro; }
4ee26c56-e43e-4218-b45c-a40a65742d66
public void setTipoLogradouro(TipoLogradouro tipoLogradouro) { this.tipoLogradouro = tipoLogradouro; }
d8c21774-a5e5-4d63-a386-f4085d480965
public Estado getEstado() { return estado; }
21e40bcf-6e30-45b0-92f5-1aa6dba480f9
public void setEstado(Estado estado) { this.estado = estado; }
22607676-f41d-4a53-bf75-90f613864b5c
public TipoEndereco getTipoEndereco() { return tipoEndereco; }
420b7382-9ced-47c4-b641-9ecd7e750a63
public void setTipoEndereco(TipoEndereco tipoEndereco) { this.tipoEndereco = tipoEndereco; }
60379020-1c65-4b31-a9f4-3b41308d450b
public Cidade getCidade() { return cidade; }
7f000885-6f31-4b0e-ad3a-5a7cf935832b
public void setCidade(Cidade cidade) { this.cidade = cidade; }
7dd4803c-195c-4cc3-8fc9-a3e72e585879
public TipoEndereco() { }
8ae813aa-2509-49df-a691-493a8089ce3c
public Integer getIdEndereco() { return idTipoEndereco; }
946bdd29-3b7c-4fba-80fb-e8208d3ee059
public void setIdEndereco(Integer idTipoEndereco) { this.idTipoEndereco = idTipoEndereco; }
f6cea285-6fa9-429d-9479-770169e8c13a
public String getNome() { return nome; }
21e305c9-9acb-491c-aa86-ea927090b74c
public void setNome(String nome) { this.nome = nome; }
a5775021-ffb6-473b-bf9e-8a4380535749
public List<Endereco> getEnderecos() { return enderecos; }
cb4251ee-116d-40e3-82b2-1d936cd31ff6
public void setEnderecos(List<Endereco> enderecos) { this.enderecos = enderecos; }
e46f14ec-b69e-4f83-9aa9-3f924fc935c2
@Override public int hashCode() { int hash = 5; hash = 37 * hash + (this.idTipoEndereco != null ? this.idTipoEndereco.hashCode() : 0); return hash; }
9ceb365f-c1a9-42d6-abfe-3f35c0fc30ec
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final TipoEndereco other = (TipoEndereco) obj; return true; }
438ea714-11d6-4171-8643-7740ff5ce5c3
public Estado() { }
4e33bbfb-05f4-425d-b23c-012715327394
public Integer getIdEstado() { return idEstado; }
7ee9d0aa-21a6-4bb6-b147-3aaa66922d3f
public void setIdEstado(Integer idEstado) { this.idEstado = idEstado; }