use of javax.annotation.PostConstruct in project engine by craftercms.
the class FolderScanningSiteListResolver method init.
@PostConstruct
public void init() {
String siteRootFolderPathRegex = String.format(SITE_ROOT_FOLDER_PATH_REGEX, siteNameMacroName);
Pattern siteRootFolderPathPattern = Pattern.compile(siteRootFolderPathRegex);
Matcher siteRootFolderPathMatcher = siteRootFolderPathPattern.matcher(siteRootFolderPath);
if (siteRootFolderPathMatcher.matches()) {
sitesFolderPath = siteRootFolderPathMatcher.group(SITES_FOLDER_PATH_GROUP);
sitesFolderPath = macroResolver.resolveMacros(sitesFolderPath);
String siteFolderNameFormat = siteRootFolderPathMatcher.group(SITE_FOLDER_NAME_FORMAT_GROUP);
String siteFolderNameRegex = siteFolderNameFormat.replace("{" + siteNameMacroName + "}", "(.+)");
siteFolderNamePattern = Pattern.compile(siteFolderNameRegex);
} else {
throw new IllegalStateException("The site root folder path " + siteRootFolderPath + " doesn't match " + "the regex " + siteRootFolderPathRegex);
}
}
use of javax.annotation.PostConstruct in project galley by Commonjava.
the class TransportManagerImpl method setup.
@PostConstruct
protected void setup() {
final List<Transport> transports = new ArrayList<Transport>();
if (injected != null) {
for (final Transport transport : injected) {
transports.add(transport);
}
}
this.transports = transports;
}
use of javax.annotation.PostConstruct in project oxTrust by GluuFederation.
the class ImageRepository method init.
@PostConstruct
public void init() throws Exception {
countLevels = appConfiguration.getPhotoRepositoryCountLeveles();
countFoldersPerLevel = appConfiguration.getPhotoRepositoryCountFoldersPerLevel();
String photoRepositoryRootDir = appConfiguration.getPhotoRepositoryRootDir();
photoRepositoryRootDirFile = new File(photoRepositoryRootDir);
// Create folders for persistent images
sourceHome = photoRepositoryRootDir + File.separator + "source";
thumbHome = photoRepositoryRootDir + File.separator + "thumb";
createFoldersTree(new File(sourceHome));
createFoldersTree(new File(thumbHome));
// Create folders for temporary images
tmpSourceHome = photoRepositoryRootDir + File.separator + TEMP_FOLDER + File.separator + "source";
tmpThumbHome = photoRepositoryRootDir + File.separator + TEMP_FOLDER + File.separator + "thumb";
createFoldersTree(new File(tmpSourceHome));
createFoldersTree(new File(tmpThumbHome));
// Create folders for removed images
if (createBackupDuringRemoval) {
removedSourceHome = photoRepositoryRootDir + File.separator + REMOVED_FOLDER + File.separator + "source";
removedThumbHome = photoRepositoryRootDir + File.separator + REMOVED_FOLDER + File.separator + "thumb";
createFoldersTree(new File(removedSourceHome));
createFoldersTree(new File(removedThumbHome));
}
prepareBlankImage();
prepareBlankPhoto();
prepareBlankIcon();
initFileTypesMap();
}
use of javax.annotation.PostConstruct in project indy by Commonjava.
the class GalleyProvider method setup.
@PostConstruct
public void setup() {
pluginDefaults = new StandardMaven304PluginDefaults();
pluginImplications = new StandardMavenPluginImplications(xml);
}
use of javax.annotation.PostConstruct in project indy by Commonjava.
the class DataFileStoreDataManager method readDefinitions.
@PostConstruct
public void readDefinitions() {
final ChangeSummary summary = new ChangeSummary(ChangeSummary.SYSTEM_USER, "Reading definitions from disk, culling invalid definition files.");
try {
DataFile[] packageDirs = manager.getDataFile(INDY_STORE).listFiles((f) -> true);
for (DataFile pkgDir : packageDirs) {
for (StoreType type : StoreType.values()) {
DataFile[] files = pkgDir.getChild(type.singularEndpointName()).listFiles(f -> true);
if (files != null) {
for (final DataFile f : files) {
try {
final String json = f.readString();
final ArtifactStore store = serializer.readValue(json, type.getStoreClass());
if (store == null) {
f.delete(summary);
} else {
storeArtifactStore(store, summary, false, false, new EventMetadata().set(StoreDataManager.EVENT_ORIGIN, LOAD_FROM_DISK));
}
} catch (final IOException e) {
logger.error(String.format("Failed to load %s store: %s. Reason: %s", type, f, e.getMessage()), e);
}
}
}
}
}
started = true;
} catch (final IndyDataException e) {
throw new IllegalStateException("Failed to start store data manager: " + e.getMessage(), e);
}
}
Aggregations