本文整理汇总了Java中org.apache.felix.ipojo.annotations.Validate类的典型用法代码示例。如果您正苦于以下问题:Java Validate类的具体用法?Java Validate怎么用?Java Validate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Validate类属于org.apache.felix.ipojo.annotations包,在下文中一共展示了Validate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import org.apache.felix.ipojo.annotations.Validate; //导入依赖的package包/类
@Validate
public void start() {
Configuration protection = this.configuration.getConfiguration("oauth2-protection");
Configuration service = protection.getConfiguration("introspection-service");
String type = service.get("type");
Map<String, Object> properties = service.asMap();
ConfigurationBuilder configurationBuilder = builder.newInstance(type)
.configure();
properties.entrySet()
.stream()
.filter(entry -> !"type".equals(entry.getKey()))
.forEach(entry -> configurationBuilder.property(entry.getKey(), entry.getValue().toString()));
handle = configurationBuilder.build();
handle.publish();
}
示例2: validate
import org.apache.felix.ipojo.annotations.Validate; //导入依赖的package包/类
/**
* Component validated
*/
@Validate
public void validate() {
// Prepare the JSON serializer
pSerializer = new JSONSerializer();
try {
pSerializer.registerDefaultSerializers();
} catch (final Exception ex) {
// Error setting up the serializer: abandon
pLogger.log(LogService.LOG_ERROR,
"Error setting up the JSON serializer: " + ex, ex);
pController = false;
return;
}
// Store the UID of the local peer
pLocalUid = pDirectory.getLocalUid();
// Start the thread pool
pExecutor = Executors.newFixedThreadPool(5);
// Everything is OK
pController = true;
}
示例3: validate
import org.apache.felix.ipojo.annotations.Validate; //导入依赖的package包/类
/**
* Component validated
*/
@Validate
public void validate() {
// Start the notification thread pool
pPool = Executors.newFixedThreadPool(5);
// Start the garbage collector
pGarbageTimer = new LoopTimer(30000, new Runnable() {
@Override
public void run() {
garbageCollect();
}
}, "Herald-GC", pEventFactory);
pGarbageTimer.start();
}
示例4: validate
import org.apache.felix.ipojo.annotations.Validate; //导入依赖的package包/类
/**
* Component validated
*/
@Validate
public void validate() {
// Preparation: deactivate the service
pServiceController = false;
// Set up the servlet
pServlet = new RegistryServlet(pRegistry, pDispatcher);
try {
pHttpService.registerServlet(pServletPath, pServlet, null, null);
} catch (final Exception ex) {
pLogger.log(LogService.LOG_ERROR,
"Error registering the dispatcher servlet. Abandon.", ex);
invalidate();
return;
}
pLogger.log(LogService.LOG_INFO, "Dispatcher servlet ready");
// No error: activate the service
pServiceController = true;
}
示例5: start
import org.apache.felix.ipojo.annotations.Validate; //导入依赖的package包/类
/**
* When the monitor starts, we initializes and registers a JSON module handling the serialization of
* the monitor extension.
*/
@Validate
public void start() {
module = new SimpleModule(MonitorExtension.class.getName());
module.addSerializer(MonitorExtension.class, new JsonSerializer<MonitorExtension>() {
@Override
public void serialize(MonitorExtension monitorExtension, JsonGenerator jsonGenerator,
SerializerProvider serializerProvider) throws IOException {
jsonGenerator.writeStartObject();
jsonGenerator.writeStringField("label", monitorExtension.label());
jsonGenerator.writeStringField("url", monitorExtension.url());
jsonGenerator.writeStringField("category", monitorExtension.category());
jsonGenerator.writeEndObject();
}
});
repository.register(module);
}
示例6: start
import org.apache.felix.ipojo.annotations.Validate; //导入依赖的package包/类
@Validate
public void start() {
// load scripts
ConfigDatabase db = conf.ensureDatabase("araqne-logdb-jython");
ConfigIterator it = db.find(ScriptConfig.class, Predicates.field("type", "parser"));
try {
for (ScriptConfig sc : it.getDocuments(ScriptConfig.class)) {
try {
PyObject o = eval(sc.getName(), sc.getScript());
scripts.put(sc.getName(), o);
} catch (Throwable t) {
logger.error("araqne logdb jython: cannot load logger script [" + sc.getName() + "]", t);
}
}
} finally {
it.close();
}
}
示例7: start
import org.apache.felix.ipojo.annotations.Validate; //导入依赖的package包/类
@Validate
public void start() {
// load scripts
ConfigDatabase db = conf.ensureDatabase("araqne-logdb-jython");
ConfigIterator it = db.find(ScriptConfig.class, Predicates.field("type", "transformer"));
try {
for (ScriptConfig sc : it.getDocuments(ScriptConfig.class)) {
try {
PyObject o = eval(sc.getName(), sc.getScript());
scripts.put(sc.getName(), o);
} catch (Throwable t) {
logger.error("araqne logdb jython: cannot load logger script [" + sc.getName() + "]", t);
}
}
} finally {
it.close();
}
}
示例8: start
import org.apache.felix.ipojo.annotations.Validate; //导入依赖的package包/类
@Validate
public void start() {
// load scripts
ConfigDatabase db = conf.ensureDatabase("araqne-logdb-jython");
ConfigIterator it = db.find(ScriptConfig.class, Predicates.field("type", "logger"));
try {
for (ScriptConfig sc : it.getDocuments(ScriptConfig.class)) {
try {
PyObject o = eval(sc.getName(), sc.getScript());
scripts.put(sc.getName(), o);
} catch (Throwable t) {
logger.error("araqne logdb jython: cannot load logger script [" + sc.getName() + "]", t);
}
}
} finally {
it.close();
}
}
示例9: start
import org.apache.felix.ipojo.annotations.Validate; //导入依赖的package包/类
@Validate
public void start() {
baseDir = new LocalFilePath(System.getProperty("araqne.data.dir")).newFilePath("araqne-logdb/saved");
baseDir.mkdirs();
cachedResults = readSavedResults();
// migrate
if (cachedResults == null) {
cachedResults = new ConcurrentHashMap<String, SavedResult>();
ConfigDatabase db = conf.ensureDatabase("araqne-logdb");
ConfigIterator it = db.findAll(SavedResult.class);
Collection<SavedResult> docs = it.getDocuments(SavedResult.class);
for (SavedResult doc : docs)
cachedResults.put(doc.getGuid(), doc);
writeSavedResults();
}
}
示例10: start
import org.apache.felix.ipojo.annotations.Validate; //导入依赖的package包/类
@Validate
public void start() throws IOException {
File f = getRepairerListFile();
if (!f.exists())
return;
// load file engine list
FileInputStream is = null;
BufferedReader br = null;
try {
is = new FileInputStream(f);
br = new BufferedReader(new InputStreamReader(is, "utf-8"));
while (true) {
String line = br.readLine();
if (line == null)
break;
String type = line.trim();
availableRepairers.put(type, new WaitEvent(type));
}
} finally {
ensureClose(br);
ensureClose(is);
}
}
示例11: start
import org.apache.felix.ipojo.annotations.Validate; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Validate
public void start() {
logDir = storageManager.resolveFilePath(System.getProperty("araqne.data.dir")).newFilePath("araqne-logstorage/log");
logDir = storageManager.resolveFilePath(getStringParameter("log_storage_dir", logDir.getAbsolutePath()));
logDir.mkdirs();
loggers.clear();
ConfigDatabase db = conf.ensureDatabase("logpresso-logstorage");
ConfigCollection col = db.ensureCollection("configs");
Config c = col.findOne(null);
if (c != null)
configs.putAll((Map<String, String>) c.getDocument());
registry.register(this);
}
示例12: start
import org.apache.felix.ipojo.annotations.Validate; //导入依赖的package包/类
@Validate
public void start() {
callbacks.clear();
dependencies.clear();
ConfigDatabase db = conf.ensureDatabase("araqne-log-api");
Collection<LoggerDependency> docs = db.findAll(LoggerDependency.class).getDocuments(LoggerDependency.class);
synchronized (dependencies) {
for (LoggerDependency d : docs) {
Set<String> s = dependencies.get(d.getSource());
if (s == null) {
s = new HashSet<String>();
dependencies.put(d.getSource(), s);
}
s.add(d.getLogger());
}
}
addListener(resolver);
isOpen = true;
}
示例13: start
import org.apache.felix.ipojo.annotations.Validate; //导入依赖的package包/类
@Validate
public void start() {
listeners = new CopyOnWriteArraySet<LogTransformerRegistryEventListener>();
profileStatuses = new ConcurrentHashMap<String, ProfileStatus>();
ConfigDatabase db = conf.ensureDatabase("araqne-log-api");
ConfigIterator it = db.find(LogTransformerProfile.class, null);
for (LogTransformerProfile p : it.getDocuments(LogTransformerProfile.class)) {
try {
loadProfile(p);
} catch (Throwable t) {
slog.warn(
"araqne log api: load transformer profile failure, profile=" + p.getName() + ", factory="
+ p.getFactoryName(), t);
}
}
factoryRegistry.addListener(updater);
tickService.addTimer(this);
}
示例14: start
import org.apache.felix.ipojo.annotations.Validate; //导入依赖的package包/类
/**
* registers the activities
*/
@Validate
public void start() {
createActivities();
for (ActivityDefinition activity : activities) {
activityService.addDefinition(activity);
}
registerEventListeners();
}
示例15: init
import org.apache.felix.ipojo.annotations.Validate; //导入依赖的package包/类
/**
* initializes message sender, creating new session and connecting to the message queue.
*
* @throws JMSException
* exception
*/
@Validate
public void init() throws JMSException {
try {
session = provider.getSession();
internalMessageProducer = getProducer(provider.getDestination());
} catch (JMSException e) {
LOGGER.error("Exception while JMS message sender instantiation", e);
throw e;
}
}