本文整理了Java中org.nuxeo.common.Environment.getDefault()
方法的一些代码示例,展示了Environment.getDefault()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Environment.getDefault()
方法的具体详情如下:
包路径:org.nuxeo.common.Environment
类名称:Environment
方法名:getDefault
暂无
代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-api
} else {
File home = Environment.getDefault().getData();
base = new File(home, path);
代码示例来源:origin: org.nuxeo.runtime/nuxeo-runtime-test
public File resolveAndCreate(File aFile) {
File temp = Environment.getDefault().getTemp();
File actual = temp.toPath().resolve(aFile.toPath()).toFile();
try {
actual.createNewFile();
} catch (IOException e) {
throw new RuntimeException("Cannot create temp file " + actual);
}
created.add(actual);
return actual;
}
}
代码示例来源:origin: org.nuxeo.ecm.webengine/nuxeo-webengine-gwt
private static File locateRoot() {
File dir = new File(Environment.getDefault().getWeb(), "root.war/gwt");
dir.mkdirs();
return dir;
}
代码示例来源:origin: org.nuxeo.ecm.automation/nuxeo-automation-core
protected boolean isTargetDirectoryForbidden() {
File nuxeoHome = Environment.getDefault().getServerHome().getAbsoluteFile();
return Paths.get(directory)
.toAbsolutePath()
.normalize()
.startsWith(nuxeoHome.toPath().toAbsolutePath().normalize());
}
代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-content-template-manager
@Override
public File getFile(String path) {
File nxDdataFolder = Environment.getDefault().getData();
return new File(nxDdataFolder, path);
}
},
代码示例来源:origin: org.nuxeo.elasticsearch/nuxeo-elasticsearch-core
/**
* @since 8.4
*/
public String getHomePath() {
if (homePath == null) {
// Since ES 2.X we need to set a home path for embedded node, but it is not used by the bundle
File dir = new File(Environment.getDefault().getTemp(), "elasticsearch");
homePath = dir.getPath();
}
return homePath;
}
代码示例来源:origin: org.nuxeo.template.rendering/nuxeo-template-rendering-core
protected File getWorkingDir() {
File workingDir = new File(Environment.getDefault().getTemp(), "NXTemplateProcessor"
+ System.currentTimeMillis());
if (workingDir.exists()) {
FileUtils.deleteQuietly(workingDir);
}
workingDir.mkdirs();
Framework.trackFile(workingDir, workingDir);
return workingDir;
}
代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-convert
protected String getDefaultCachingDirectory() {
File cache = new File(Environment.getDefault().getData(), DEFAULT_CACHING_DIRECTORY);
return cache.getAbsolutePath();
}
代码示例来源:origin: org.nuxeo.runtime/nuxeo-runtime-reload
protected static File getAppDir() {
return Environment.getDefault().getConfig().getParentFile();
}
代码示例来源:origin: org.nuxeo.runtime/nuxeo-connect-standalone
public PackagePersistence(PackageUpdateService pus) throws IOException {
Environment env = Environment.getDefault();
root = env.getPath(Environment.NUXEO_MP_DIR, Environment.DEFAULT_MP_DIR);
if (!root.isAbsolute()) {
throw new RuntimeException();
}
root.mkdirs();
store = new File(root, "store");
store.mkdirs();
temp = new File(root, "tmp");
temp.mkdirs();
service = pus;
states = loadStates();
}
代码示例来源:origin: org.nuxeo.elasticsearch/nuxeo-elasticsearch-core
protected InputStream getResourceStream(String filename) {
// First check if the resource is available on the config directory
File file = new File(Environment.getDefault().getConfig(), filename);
if (file.exists()) {
try {
return new FileInputStream(file);
} catch (FileNotFoundException e) {
// try another way
}
}
// getResourceAsStream is needed getResource will not work when called from another module
InputStream ret = this.getClass().getClassLoader().getResourceAsStream(filename);
if (ret == null) {
// Then try to get it from jar
ret = this.getClass().getClassLoader().getResourceAsStream(filename);
}
if (ret == null) {
throw new IllegalArgumentException(
String.format("Resource file cannot be found: %s or %s", file.getAbsolutePath(), filename));
}
return ret;
}
代码示例来源:origin: org.nuxeo.runtime/nuxeo-runtime-test
@Override
public void beforeMethodRun(FeaturesRunner runner, FrameworkMethod method, Object test) throws Exception {
File temp = Environment.getDefault().getTemp();
tempPath = temp.toPath();
tracked.clear();
created.clear();
listener.install();
}
代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-cache
private File getDataDir(TransientStoreConfig config) {
String dataDirPath = config.getDataDir();
if (StringUtils.isBlank(dataDirPath)) {
File transienStoreHome = new File(Environment.getDefault().getData(), "transientstores");
return new File(transienStoreHome, config.getName());
} else {
return new File(dataDirPath);
}
}
代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-schema
public SchemaManagerImpl() {
recomputeCallbacks = new ArrayList<>();
schemaDir = new File(Environment.getDefault().getTemp(), SCHEMAS_DIR_NAME);
schemaDir.mkdirs();
clearSchemaDir();
registerBuiltinTypes();
}
代码示例来源:origin: org.nuxeo.runtime/nuxeo-runtime-osgi
/**
* @since 5.5
* @return Environment summary
*/
protected static StringBuilder getStartMessage() {
String newline = System.getProperty("line.separator");
Environment env = Environment.getDefault();
String hr = "======================================================================";
StringBuilder msg = new StringBuilder(newline);
msg.append(hr).append(newline);
msg.append("= Starting Nuxeo Framework").append(newline);
msg.append(hr).append(newline);
msg.append(" * Server home = ").append(env.getServerHome()).append(newline);
msg.append(" * Runtime home = ").append(env.getRuntimeHome()).append(newline);
msg.append(" * Data Directory = ").append(env.getData()).append(newline);
msg.append(" * Log Directory = ").append(env.getLog()).append(newline);
msg.append(" * Configuration Directory = ").append(env.getConfig()).append(newline);
msg.append(" * Temp Directory = ").append(env.getTemp()).append(newline);
msg.append(hr);
return msg;
}
}
代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-test
@Override
public void beforeSetup(FeaturesRunner runner) throws Exception {
server = SimpleSmtpServer.start(SERVER_PORT);
if (Framework.isInitialized()) {
File file = new File(Environment.getDefault().getConfig(), "mail.properties");
List<String> mailProperties = new ArrayList<>();
mailProperties.add(String.format("mail.smtp.host = %s", SERVER_HOST));
mailProperties.add(String.format("mail.smtp.port = %s", SERVER_PORT));
FileUtils.writeLines(file, mailProperties);
Framework.getProperties().put("mail.transport.host", SERVER_HOST);
Framework.getProperties().put("mail.transport.port", String.valueOf(SERVER_PORT));
}
}
代码示例来源:origin: org.nuxeo.runtime/nuxeo-runtime-reload
@Override
public void runDeploymentPreprocessor() throws IOException {
log.info("Start running deployment preprocessor");
String rootPath = Environment.getDefault().getRuntimeHome().getAbsolutePath();
File root = new File(rootPath);
DeploymentPreprocessor processor = new DeploymentPreprocessor(root);
// initialize
processor.init();
// and predeploy
processor.predeploy();
log.info("Deployment preprocessing done");
}
代码示例来源:origin: org.nuxeo.runtime/nuxeo-runtime-test
@Override
public void start(BundleContext context) {
log.info("Starting Runtime Activator");
// create the runtime
runtime = new OSGiRuntimeService(context);
String tempDir = Environment.getDefault().getTemp().getAbsolutePath();
System.setProperty("java.io.tmpdir", tempDir);
System.setProperty(Environment.NUXEO_TMP_DIR, tempDir);
// load main config file if any
URL config = context.getBundle().getResource("/OSGI-INF/nuxeo.properties");
if (config != null) {
System.setProperty(OSGiRuntimeService.PROP_CONFIG_DIR, config.toExternalForm());
}
initialize(runtime);
// start it
Framework.initialize(runtime);
// register bundle component loader
componentLoader = new OSGiComponentLoader(runtime);
// TODO register osgi services
}
代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-web-common
/**
* @deprecated since 9.1. It was defined for ClipboardActionsBean but it seems not to be used anymore.
*/
@Deprecated
protected void handleDownloadTemporaryZip(HttpServletRequest req, HttpServletResponse resp, String filePath)
throws IOException {
String[] pathParts = filePath.split("/");
String tmpFileName = pathParts[0];
File tmpZip = new File(Environment.getDefault().getTemp(), tmpFileName);
try {
Blob zipBlob = Blobs.createBlob(tmpZip);
DownloadService downloadService = Framework.getService(DownloadService.class);
downloadService.downloadBlob(req, resp, null, null, zipBlob, "clipboard.zip", "clipboardZip");
} finally {
tmpZip.delete();
}
}
代码示例来源:origin: org.nuxeo.runtime/nuxeo-runtime-server
@Override
public void addWepApp(WebApplication descriptor) {
String contextPath = normalizeContextPath(descriptor.getContextPath());
File home = Environment.getDefault().getHome();
File docBase = new File(home, descriptor.getWebRoot());
docBase.mkdirs(); // make sure the WAR root exists
Context context = tomcat.addWebapp(contextPath, docBase.getAbsolutePath());
StandardJarScanner jarScanner = (StandardJarScanner) context.getJarScanner();
// avoid costly scanning, we register everything explicitly
jarScanner.setScanManifest(false); // many MANIFEST.MF files have incorrect Class-Path
jarScanner.setScanAllDirectories(false);
jarScanner.setScanAllFiles(false);
jarScanner.setScanBootstrapClassPath(false);
jarScanner.setScanClassPath(false);
}
内容来源于网络,如有侵权,请联系作者删除!