-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1052 from eclipse-passage/1049
1049 Operator: issue personal license pack to dedicated folder
- Loading branch information
Showing
3 changed files
with
50 additions
and
15 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
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
47 changes: 47 additions & 0 deletions
47
...icenses.core/src/org/eclipse/passage/loc/internal/licenses/core/LicensePackResidence.java
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,47 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2022 ArSysOp | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* https://www.eclipse.org/legal/epl-2.0/. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* ArSysOp - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.passage.loc.internal.licenses.core; | ||
|
||
import java.nio.file.Path; | ||
import java.util.function.Supplier; | ||
|
||
import org.eclipse.passage.lic.base.io.UserHomeProductResidence; | ||
import org.eclipse.passage.lic.licenses.model.api.LicenseRequisites; | ||
|
||
final class LicensePackResidence implements Supplier<Path> { | ||
|
||
private final LicenseRequisites license; | ||
|
||
LicensePackResidence(LicenseRequisites license) { | ||
this.license = license; | ||
} | ||
|
||
@Override | ||
public Path get() { | ||
return existing(residence()); | ||
} | ||
|
||
private Path residence() { | ||
return new UserHomeProductResidence(// | ||
license.getProduct().getIdentifier(), // | ||
license.getProduct().getVersion())// | ||
.get()// | ||
.resolve(license.getIdentifier()); | ||
} | ||
|
||
private Path existing(Path folder) { | ||
folder.toFile().mkdirs(); | ||
return folder; | ||
} | ||
|
||
} |