当前位置: 首页>>代码示例>>Java>>正文


Java Validate类代码示例

本文整理汇总了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();
}
 
开发者ID:sauthieg,项目名称:wisdom-oauth2-protection,代码行数:17,代码来源:ProtectionBootstrap.java

示例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;
}
 
开发者ID:cohorte,项目名称:cohorte-herald,代码行数:28,代码来源:HttpTransport.java

示例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();
}
 
开发者ID:cohorte,项目名称:cohorte-herald,代码行数:21,代码来源:Herald.java

示例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;
}
 
开发者ID:cohorte,项目名称:cohorte-remote-services,代码行数:27,代码来源:ServletWrapper.java

示例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);
}
 
开发者ID:wisdom-framework,项目名称:wisdom,代码行数:21,代码来源:MonitorCenter.java

示例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();
	}

}
 
开发者ID:araqne,项目名称:logdb,代码行数:20,代码来源:JythonParserScriptRegistryImpl.java

示例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();
	}

}
 
开发者ID:araqne,项目名称:logdb,代码行数:20,代码来源:JythonTransformerScriptRegistryImpl.java

示例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();
	}

}
 
开发者ID:araqne,项目名称:logdb,代码行数:20,代码来源:JythonLoggerScriptRegistryImpl.java

示例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();
	}
}
 
开发者ID:araqne,项目名称:logdb,代码行数:19,代码来源:SavedResultManagerImpl.java

示例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);
	}
}
 
开发者ID:araqne,项目名称:logdb,代码行数:27,代码来源:LogFileRepairerRegistryImpl.java

示例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);
}
 
开发者ID:araqne,项目名称:logdb,代码行数:18,代码来源:LogFileServiceV3o.java

示例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;
}
 
开发者ID:araqne,项目名称:logdb,代码行数:23,代码来源:LoggerRegistryImpl.java

示例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);
}
 
开发者ID:araqne,项目名称:logdb,代码行数:22,代码来源:LogTransformerRegistryImpl.java

示例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();
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:12,代码来源:ActivityCoreBundleActivator.java

示例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;
    }
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:19,代码来源:JMSMessageSender.java


注:本文中的org.apache.felix.ipojo.annotations.Validate类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。