Search in sources :

Example 81 with PostConstruct

use of javax.annotation.PostConstruct in project sakuli by ConSol.

the class ScreenBasedSettings method setDefaults.

@PostConstruct
public void setDefaults() {
    setMinSimilarity(currentSimilarity);
    WaitScanRate = 10f;
    ObserveScanRate = 10f;
    ClickDelay = props.getClickDelay();
    RobotDesktop.stdAutoDelay = props.getTypeDelayMs();
    //if stdAutoDelay is set TypeDelay is no longer needed!
    TypeDelay = 0;
    OcrDataPath = sakuliProps.getTessDataLibFolder().toAbsolutePath().toString();
    OcrTextSearch = true;
    OcrTextRead = true;
    Highlight = props.isAutoHighlightEnabled();
    if (props.getDefaultHighlightSeconds() < 1) {
        /**
             * because of the mehtode {@link org.sikuli.script.ScreenHighlighter#closeAfter(float)}
             * */
        throw new InvalidParameterException("the property '" + ActionProperties.DEFAULT_HIGHLIGHT_SEC + "' has to be greater as 1, but was " + props.getDefaultHighlightSeconds());
    }
    DefaultHighlightTime = props.getDefaultHighlightSeconds();
    WaitAfterHighlight = 0.1f;
    /***
         * Logging for sikuliX => {@link SysOutOverSLF4J} will send the logs to SLF4J
         */
    Logger sikuliLogger = LoggerFactory.getLogger(Debug.class);
    if (sikuliLogger.isInfoEnabled()) {
        LOGGER.debug("sikuli log level INFO enabled");
        ActionLogs = true;
        InfoLogs = true;
        ProfileLogs = true;
    }
    if (sikuliLogger.isDebugEnabled()) {
        LOGGER.debug("sikuli log level DEBUG enabled");
        DebugLogs = true;
    }
}
Also used : InvalidParameterException(java.security.InvalidParameterException) Logger(org.slf4j.Logger) PostConstruct(javax.annotation.PostConstruct)

Example 82 with PostConstruct

use of javax.annotation.PostConstruct in project indy by Commonjava.

the class TestProvider method setup.

//    private Http http;
//
//    private IndyLocationExpander locationExpander;
//
//    private IndyLocationResolver locationResolver;
@PostConstruct
public void setup() {
    storeDataManager = new MemoryStoreDataManager(true);
    nfc = new MemoryNotFoundCache();
    objectMapper = new IndyObjectMapper(false);
    fileEventManager = new NoOpFileEventManager();
    transferDecorator = new NoOpTransferDecorator();
    transportManagerConfig = new TransportManagerConfig();
    temp = new TemporaryFolder();
    try {
        temp.create();
        cacheProvider = new FileCacheProvider(temp.newFolder("storage"), indyPathGenerator, fileEventManager, transferDecorator);
    } catch (IOException e) {
        fail("Cannot initialize temporary directory structure");
        temp.delete();
    }
}
Also used : FileCacheProvider(org.commonjava.maven.galley.cache.FileCacheProvider) NoOpFileEventManager(org.commonjava.maven.galley.event.NoOpFileEventManager) NoOpTransferDecorator(org.commonjava.maven.galley.io.NoOpTransferDecorator) IndyObjectMapper(org.commonjava.indy.model.core.io.IndyObjectMapper) MemoryStoreDataManager(org.commonjava.indy.mem.data.MemoryStoreDataManager) TemporaryFolder(org.junit.rules.TemporaryFolder) TransportManagerConfig(org.commonjava.maven.galley.config.TransportManagerConfig) MemoryNotFoundCache(org.commonjava.maven.galley.nfc.MemoryNotFoundCache) IOException(java.io.IOException) PostConstruct(javax.annotation.PostConstruct)

Example 83 with PostConstruct

use of javax.annotation.PostConstruct in project midpoint by Evolveum.

the class ConnectorFactoryConnIdImpl method initialize.

/**
	 * Initialize the ICF implementation. Look for all connector bundles, get
	 * basic information about them and keep that in memory.
	 */
@PostConstruct
public void initialize() {
    // OLD
    // bundleURLs = listBundleJars();
    bundleURLs = new HashSet<URL>();
    Configuration config = midpointConfiguration.getConfiguration("midpoint.icf");
    // Is classpath scan enabled
    if (config.getBoolean("scanClasspath")) {
        // Scan class path
        bundleURLs.addAll(scanClassPathForBundles());
    }
    // Scan all provided directories
    @SuppressWarnings("unchecked") List<String> dirs = config.getList("scanDirectory");
    for (String dir : dirs) {
        bundleURLs.addAll(scanDirectory(dir));
    }
    for (URL u : bundleURLs) {
        LOGGER.debug("ICF bundle URL : {}", u);
    }
    connectorInfoManagerFactory = ConnectorInfoManagerFactory.getInstance();
}
Also used : MidpointConfiguration(com.evolveum.midpoint.common.configuration.api.MidpointConfiguration) APIConfiguration(org.identityconnectors.framework.api.APIConfiguration) Configuration(org.apache.commons.configuration.Configuration) GuardedString(org.identityconnectors.common.security.GuardedString) URL(java.net.URL) PostConstruct(javax.annotation.PostConstruct)

Example 84 with PostConstruct

use of javax.annotation.PostConstruct in project dhis2-core by dhis2.

the class DefaultFieldFilterService method init.

@PostConstruct
public void init() {
    ImmutableMap.Builder<String, Preset> presetBuilder = ImmutableMap.builder();
    for (Preset preset : Preset.values()) {
        presetBuilder.put(preset.getName(), preset);
    }
    presets = presetBuilder.build();
    ImmutableMap.Builder<String, NodeTransformer> transformerBuilder = ImmutableMap.builder();
    for (NodeTransformer transformer : nodeTransformers) {
        transformerBuilder.put(transformer.name(), transformer);
    }
    transformers = transformerBuilder.build();
}
Also used : NodeTransformer(org.hisp.dhis.node.NodeTransformer) Preset(org.hisp.dhis.node.Preset) ImmutableMap(com.google.common.collect.ImmutableMap) PostConstruct(javax.annotation.PostConstruct)

Example 85 with PostConstruct

use of javax.annotation.PostConstruct in project dhis2-core by dhis2.

the class JCloudsFileResourceContentStore method init.

// -------------------------------------------------------------------------
// Life cycle management
// -------------------------------------------------------------------------
@PostConstruct
public void init() {
    // ---------------------------------------------------------------------
    // Bootstrap config
    // ---------------------------------------------------------------------
    config = new BlobStoreProperties(configurationProvider.getProperty(ConfigurationKey.FILESTORE_PROVIDER), configurationProvider.getProperty(ConfigurationKey.FILESTORE_LOCATION), configurationProvider.getProperty(ConfigurationKey.FILESTORE_CONTAINER));
    Pair<Credentials, Properties> providerConfig = configureForProvider(config.provider, configurationProvider.getProperty(ConfigurationKey.FILESTORE_IDENTITY), configurationProvider.getProperty(ConfigurationKey.FILESTORE_SECRET));
    // ---------------------------------------------------------------------
    // Set up JClouds context
    // ---------------------------------------------------------------------
    blobStoreContext = ContextBuilder.newBuilder(config.provider).credentials(providerConfig.getLeft().identity, providerConfig.getLeft().credential).overrides(providerConfig.getRight()).build(BlobStoreContext.class);
    blobStore = blobStoreContext.getBlobStore();
    Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id(config.provider).description(config.provider).build();
    try {
        blobStore.createContainerInLocation(createRegionLocation(config, provider), config.container);
        log.info(String.format("File store configured with provider: '%s', container: '%s' and location: '%s'.", config.provider, config.container, config.location));
    } catch (HttpResponseException ex) {
        log.error(String.format("Could not configure file store with provider '%s' and container '%s'.\n" + "File storage will not be available.", config.provider, config.container), ex);
    } catch (AuthorizationException ex) {
        log.error(String.format("Could not authenticate with file store provider '%s' and container '%s'. " + "File storage will not be available.", config.provider, config.location), ex);
    }
}
Also used : LocationBuilder(org.jclouds.domain.LocationBuilder) AuthorizationException(org.jclouds.rest.AuthorizationException) HttpResponseException(org.jclouds.http.HttpResponseException) BlobStoreContext(org.jclouds.blobstore.BlobStoreContext) Properties(java.util.Properties) Credentials(org.jclouds.domain.Credentials) Location(org.jclouds.domain.Location) 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