Search in sources :

Example 71 with PostConstruct

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);
    }
}
Also used : Pattern(java.util.regex.Pattern) Matcher(java.util.regex.Matcher) PostConstruct(javax.annotation.PostConstruct)

Example 72 with PostConstruct

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;
}
Also used : ArrayList(java.util.ArrayList) Transport(org.commonjava.maven.galley.spi.transport.Transport) PostConstruct(javax.annotation.PostConstruct)

Example 73 with PostConstruct

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();
}
Also used : File(java.io.File) PostConstruct(javax.annotation.PostConstruct)

Example 74 with PostConstruct

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);
}
Also used : StandardMaven304PluginDefaults(org.commonjava.maven.galley.maven.internal.defaults.StandardMaven304PluginDefaults) StandardMavenPluginImplications(org.commonjava.maven.galley.maven.internal.defaults.StandardMavenPluginImplications) PostConstruct(javax.annotation.PostConstruct)

Example 75 with PostConstruct

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);
    }
}
Also used : DataFile(org.commonjava.indy.subsys.datafile.DataFile) StoreType(org.commonjava.indy.model.core.StoreType) IndyDataException(org.commonjava.indy.data.IndyDataException) ArtifactStore(org.commonjava.indy.model.core.ArtifactStore) IOException(java.io.IOException) ChangeSummary(org.commonjava.indy.audit.ChangeSummary) EventMetadata(org.commonjava.maven.galley.event.EventMetadata) PostConstruct(javax.annotation.PostConstruct)

Aggregations

PostConstruct (javax.annotation.PostConstruct)248 IOException (java.io.IOException)28 File (java.io.File)18 SamlRegisteredService (org.apereo.cas.support.saml.services.SamlRegisteredService)17 Map (java.util.Map)15 ArrayList (java.util.ArrayList)12 ExternalResource (com.vaadin.server.ExternalResource)11 HashMap (java.util.HashMap)10 InitialContext (javax.naming.InitialContext)9 Label (com.vaadin.ui.Label)8 VerticalLayout (com.vaadin.ui.VerticalLayout)8 Request (com.nabalive.framework.web.Request)7 Response (com.nabalive.framework.web.Response)7 Route (com.nabalive.framework.web.Route)7 Link (com.vaadin.ui.Link)7 Properties (java.util.Properties)7 Method (java.lang.reflect.Method)5 InputStream (java.io.InputStream)4 URISyntaxException (java.net.URISyntaxException)4 Path (java.nio.file.Path)4