mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-15 15:02:20 +00:00
Merged 5.1.N (5.1.2) to 5.2.N (5.2.1)
125605 rmunteanu: Merged 5.1.1 (5.1.1) to 5.1.N (5.1.2) 125498 slanglois: MNT-16155 Update source headers - remove svn:eol-style property on Java and JSP source files git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@125783 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,181 +1,181 @@
|
||||
package org.alfresco.repo.descriptor;
|
||||
|
||||
import java.security.Principal;
|
||||
import java.util.Date;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.alfresco.repo.mode.ServerModeProvider;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.service.cmr.admin.RepoUsage.LicenseMode;
|
||||
import org.alfresco.service.descriptor.Descriptor;
|
||||
import org.alfresco.service.descriptor.DescriptorService;
|
||||
import org.alfresco.service.license.LicenseDescriptor;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.extensions.surf.util.AbstractLifecycleBean;
|
||||
import org.springframework.extensions.surf.util.I18NUtil;
|
||||
|
||||
/**
|
||||
* Provide a Repository Startup Log
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public class DescriptorStartupLog extends AbstractLifecycleBean
|
||||
{
|
||||
// Logger
|
||||
private static final Log logger = LogFactory.getLog(DescriptorService.class);
|
||||
|
||||
// Dependencies
|
||||
private DescriptorService descriptorService;
|
||||
private TransactionService transactionService;
|
||||
private ServerModeProvider serverModeProvider;
|
||||
|
||||
private final String SYSTEM_INFO_STARTUP = "system.info.startup";
|
||||
private final String SYSTEM_WARN_READONLY = "system.warn.readonly";
|
||||
|
||||
/**
|
||||
* @param descriptorService Descriptor Service
|
||||
*/
|
||||
public void setDescriptorService(DescriptorService descriptorService)
|
||||
{
|
||||
this.descriptorService = descriptorService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param transactionService service to tell about read-write mode
|
||||
*/
|
||||
public void setTransactionService(TransactionService transactionService)
|
||||
{
|
||||
this.transactionService = transactionService;
|
||||
}
|
||||
|
||||
public void setServerModeProvider(ServerModeProvider serverModeProvider)
|
||||
{
|
||||
this.serverModeProvider = serverModeProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBootstrap(ApplicationEvent event)
|
||||
{
|
||||
//
|
||||
// log output of VM stats
|
||||
//
|
||||
Properties properties = System.getProperties();
|
||||
String version = (properties.get("java.runtime.version") == null) ? "unknown" : (String)properties.get("java.runtime.version");
|
||||
long maxHeap = Runtime.getRuntime().maxMemory();
|
||||
float maxHeapMB = maxHeap / 1024l;
|
||||
maxHeapMB = maxHeapMB / 1024l;
|
||||
if (logger.isInfoEnabled())
|
||||
{
|
||||
logger.info(String.format("Alfresco JVM - v%s; maximum heap size %.3fMB", version, maxHeapMB));
|
||||
}
|
||||
if (logger.isWarnEnabled())
|
||||
{
|
||||
if (version.startsWith("1.2") || version.startsWith("1.3") || version.startsWith("1.4"))
|
||||
{
|
||||
logger.warn(String.format("Alfresco JVM - WARNING - v1.5 is required; currently using v%s", version));
|
||||
}
|
||||
if (maxHeapMB < 500)
|
||||
{
|
||||
logger.warn(String.format("Alfresco JVM - WARNING - maximum heap size %.3fMB is less than recommended 512MB", maxHeapMB));
|
||||
}
|
||||
}
|
||||
|
||||
// Log License Descriptors (if applicable)
|
||||
LicenseDescriptor license = descriptorService.getLicenseDescriptor();
|
||||
if (license != null && logger.isInfoEnabled())
|
||||
{
|
||||
LicenseMode licenseMode = license.getLicenseMode();
|
||||
|
||||
String msg = "Alfresco license: Mode " + licenseMode;
|
||||
|
||||
if(license.isClusterEnabled())
|
||||
{
|
||||
msg += ", cluster:enabled";
|
||||
}
|
||||
else
|
||||
{
|
||||
msg += ", NO CLUSTER";
|
||||
}
|
||||
|
||||
String holder = license.getHolderOrganisation();
|
||||
if (holder != null)
|
||||
{
|
||||
msg += " granted to " + holder;
|
||||
}
|
||||
|
||||
Date validUntil = license.getValidUntil();
|
||||
|
||||
if (validUntil != null)
|
||||
{
|
||||
Integer days = license.getDays();
|
||||
Integer remainingDays = license.getRemainingDays();
|
||||
|
||||
msg += " limited to " + days + " days expiring " + validUntil + " (" + remainingDays + " days remaining).";
|
||||
}
|
||||
else
|
||||
{
|
||||
msg += " (does not expire).";
|
||||
}
|
||||
|
||||
Long maxUsers = license.getMaxUsers();
|
||||
if (maxUsers != null)
|
||||
{
|
||||
msg += " User limit is " + maxUsers + ".";
|
||||
}
|
||||
Long maxDocs = license.getMaxDocs();
|
||||
if (maxDocs != null)
|
||||
{
|
||||
msg += " Content Object limit is " + maxDocs + ".";
|
||||
}
|
||||
|
||||
/*
|
||||
* This is an important information logging since it logs the license
|
||||
*/
|
||||
logger.info(msg);
|
||||
}
|
||||
|
||||
// Log Repository Descriptors
|
||||
if (logger.isInfoEnabled())
|
||||
{
|
||||
logger.info("Server Mode :" + serverModeProvider.getServerMode());
|
||||
Descriptor serverDescriptor = descriptorService.getServerDescriptor();
|
||||
Descriptor currentDescriptor = descriptorService.getCurrentRepositoryDescriptor();
|
||||
Descriptor installedRepoDescriptor = descriptorService.getInstalledRepositoryDescriptor();
|
||||
|
||||
String serverEdition = serverDescriptor.getEdition();
|
||||
|
||||
String currentVersion = currentDescriptor.getVersion();
|
||||
int currentSchemaVersion = currentDescriptor.getSchema();
|
||||
LicenseMode currentMode = currentDescriptor.getLicenseMode();
|
||||
|
||||
String installedRepoVersion = installedRepoDescriptor.getVersion();
|
||||
int installedSchemaVersion = installedRepoDescriptor.getSchema();
|
||||
|
||||
|
||||
/*
|
||||
* Alfresco started
|
||||
*/
|
||||
Object[] params = new Object[] {
|
||||
serverEdition,
|
||||
currentMode != LicenseMode.TEAM ? "" : (" " + currentMode), // only append TEAM
|
||||
(!AuthenticationUtil.isMtEnabled() ? "" : (" Multi-Tenant")),
|
||||
currentVersion, currentSchemaVersion, installedRepoVersion, installedSchemaVersion};
|
||||
logger.info(I18NUtil.getMessage(SYSTEM_INFO_STARTUP, params));
|
||||
}
|
||||
|
||||
// Issue a warning if the system is in read-only mode
|
||||
if (logger.isWarnEnabled() && !transactionService.getAllowWrite())
|
||||
{
|
||||
logger.warn(I18NUtil.getMessage(SYSTEM_WARN_READONLY));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onShutdown(ApplicationEvent event)
|
||||
{
|
||||
// NOOP
|
||||
}
|
||||
package org.alfresco.repo.descriptor;
|
||||
|
||||
import java.security.Principal;
|
||||
import java.util.Date;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.alfresco.repo.mode.ServerModeProvider;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.service.cmr.admin.RepoUsage.LicenseMode;
|
||||
import org.alfresco.service.descriptor.Descriptor;
|
||||
import org.alfresco.service.descriptor.DescriptorService;
|
||||
import org.alfresco.service.license.LicenseDescriptor;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.extensions.surf.util.AbstractLifecycleBean;
|
||||
import org.springframework.extensions.surf.util.I18NUtil;
|
||||
|
||||
/**
|
||||
* Provide a Repository Startup Log
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public class DescriptorStartupLog extends AbstractLifecycleBean
|
||||
{
|
||||
// Logger
|
||||
private static final Log logger = LogFactory.getLog(DescriptorService.class);
|
||||
|
||||
// Dependencies
|
||||
private DescriptorService descriptorService;
|
||||
private TransactionService transactionService;
|
||||
private ServerModeProvider serverModeProvider;
|
||||
|
||||
private final String SYSTEM_INFO_STARTUP = "system.info.startup";
|
||||
private final String SYSTEM_WARN_READONLY = "system.warn.readonly";
|
||||
|
||||
/**
|
||||
* @param descriptorService Descriptor Service
|
||||
*/
|
||||
public void setDescriptorService(DescriptorService descriptorService)
|
||||
{
|
||||
this.descriptorService = descriptorService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param transactionService service to tell about read-write mode
|
||||
*/
|
||||
public void setTransactionService(TransactionService transactionService)
|
||||
{
|
||||
this.transactionService = transactionService;
|
||||
}
|
||||
|
||||
public void setServerModeProvider(ServerModeProvider serverModeProvider)
|
||||
{
|
||||
this.serverModeProvider = serverModeProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBootstrap(ApplicationEvent event)
|
||||
{
|
||||
//
|
||||
// log output of VM stats
|
||||
//
|
||||
Properties properties = System.getProperties();
|
||||
String version = (properties.get("java.runtime.version") == null) ? "unknown" : (String)properties.get("java.runtime.version");
|
||||
long maxHeap = Runtime.getRuntime().maxMemory();
|
||||
float maxHeapMB = maxHeap / 1024l;
|
||||
maxHeapMB = maxHeapMB / 1024l;
|
||||
if (logger.isInfoEnabled())
|
||||
{
|
||||
logger.info(String.format("Alfresco JVM - v%s; maximum heap size %.3fMB", version, maxHeapMB));
|
||||
}
|
||||
if (logger.isWarnEnabled())
|
||||
{
|
||||
if (version.startsWith("1.2") || version.startsWith("1.3") || version.startsWith("1.4"))
|
||||
{
|
||||
logger.warn(String.format("Alfresco JVM - WARNING - v1.5 is required; currently using v%s", version));
|
||||
}
|
||||
if (maxHeapMB < 500)
|
||||
{
|
||||
logger.warn(String.format("Alfresco JVM - WARNING - maximum heap size %.3fMB is less than recommended 512MB", maxHeapMB));
|
||||
}
|
||||
}
|
||||
|
||||
// Log License Descriptors (if applicable)
|
||||
LicenseDescriptor license = descriptorService.getLicenseDescriptor();
|
||||
if (license != null && logger.isInfoEnabled())
|
||||
{
|
||||
LicenseMode licenseMode = license.getLicenseMode();
|
||||
|
||||
String msg = "Alfresco license: Mode " + licenseMode;
|
||||
|
||||
if(license.isClusterEnabled())
|
||||
{
|
||||
msg += ", cluster:enabled";
|
||||
}
|
||||
else
|
||||
{
|
||||
msg += ", NO CLUSTER";
|
||||
}
|
||||
|
||||
String holder = license.getHolderOrganisation();
|
||||
if (holder != null)
|
||||
{
|
||||
msg += " granted to " + holder;
|
||||
}
|
||||
|
||||
Date validUntil = license.getValidUntil();
|
||||
|
||||
if (validUntil != null)
|
||||
{
|
||||
Integer days = license.getDays();
|
||||
Integer remainingDays = license.getRemainingDays();
|
||||
|
||||
msg += " limited to " + days + " days expiring " + validUntil + " (" + remainingDays + " days remaining).";
|
||||
}
|
||||
else
|
||||
{
|
||||
msg += " (does not expire).";
|
||||
}
|
||||
|
||||
Long maxUsers = license.getMaxUsers();
|
||||
if (maxUsers != null)
|
||||
{
|
||||
msg += " User limit is " + maxUsers + ".";
|
||||
}
|
||||
Long maxDocs = license.getMaxDocs();
|
||||
if (maxDocs != null)
|
||||
{
|
||||
msg += " Content Object limit is " + maxDocs + ".";
|
||||
}
|
||||
|
||||
/*
|
||||
* This is an important information logging since it logs the license
|
||||
*/
|
||||
logger.info(msg);
|
||||
}
|
||||
|
||||
// Log Repository Descriptors
|
||||
if (logger.isInfoEnabled())
|
||||
{
|
||||
logger.info("Server Mode :" + serverModeProvider.getServerMode());
|
||||
Descriptor serverDescriptor = descriptorService.getServerDescriptor();
|
||||
Descriptor currentDescriptor = descriptorService.getCurrentRepositoryDescriptor();
|
||||
Descriptor installedRepoDescriptor = descriptorService.getInstalledRepositoryDescriptor();
|
||||
|
||||
String serverEdition = serverDescriptor.getEdition();
|
||||
|
||||
String currentVersion = currentDescriptor.getVersion();
|
||||
int currentSchemaVersion = currentDescriptor.getSchema();
|
||||
LicenseMode currentMode = currentDescriptor.getLicenseMode();
|
||||
|
||||
String installedRepoVersion = installedRepoDescriptor.getVersion();
|
||||
int installedSchemaVersion = installedRepoDescriptor.getSchema();
|
||||
|
||||
|
||||
/*
|
||||
* Alfresco started
|
||||
*/
|
||||
Object[] params = new Object[] {
|
||||
serverEdition,
|
||||
currentMode != LicenseMode.TEAM ? "" : (" " + currentMode), // only append TEAM
|
||||
(!AuthenticationUtil.isMtEnabled() ? "" : (" Multi-Tenant")),
|
||||
currentVersion, currentSchemaVersion, installedRepoVersion, installedSchemaVersion};
|
||||
logger.info(I18NUtil.getMessage(SYSTEM_INFO_STARTUP, params));
|
||||
}
|
||||
|
||||
// Issue a warning if the system is in read-only mode
|
||||
if (logger.isWarnEnabled() && !transactionService.getAllowWrite())
|
||||
{
|
||||
logger.warn(I18NUtil.getMessage(SYSTEM_WARN_READONLY));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onShutdown(ApplicationEvent event)
|
||||
{
|
||||
// NOOP
|
||||
}
|
||||
}
|
@@ -1,45 +1,45 @@
|
||||
|
||||
package org.alfresco.repo.descriptor;
|
||||
|
||||
/**
|
||||
* The licence resource component knows the locations where license files
|
||||
* may be found.
|
||||
*
|
||||
* Locations are suitable to be loaded by spring's getResource method.
|
||||
*
|
||||
*/
|
||||
public class LicenseResourceComponent
|
||||
{
|
||||
public LicenseResourceComponent()
|
||||
{
|
||||
}
|
||||
|
||||
private String externalLicenseLocation = "*.lic";
|
||||
private String embeddedLicenseLocation = "/WEB-INF/alfresco/license/*.lic";
|
||||
private String sharedLicenseLocation = "classpath*:/alfresco/extension/license/*.lic";
|
||||
|
||||
public void setExternalLicenseLocation(String externalLicenseLocation)
|
||||
{
|
||||
this.externalLicenseLocation = externalLicenseLocation;
|
||||
}
|
||||
public String getExternalLicenseLocation()
|
||||
{
|
||||
return externalLicenseLocation;
|
||||
}
|
||||
public void setEmbeddedLicenseLocation(String embeddedLicenseLocation)
|
||||
{
|
||||
this.embeddedLicenseLocation = embeddedLicenseLocation;
|
||||
}
|
||||
public String getEmbeddedLicenseLocation()
|
||||
{
|
||||
return embeddedLicenseLocation;
|
||||
}
|
||||
public void setSharedLicenseLocation(String sharedLicenseLocation)
|
||||
{
|
||||
this.sharedLicenseLocation = sharedLicenseLocation;
|
||||
}
|
||||
public String getSharedLicenseLocation()
|
||||
{
|
||||
return sharedLicenseLocation;
|
||||
}
|
||||
}
|
||||
|
||||
package org.alfresco.repo.descriptor;
|
||||
|
||||
/**
|
||||
* The licence resource component knows the locations where license files
|
||||
* may be found.
|
||||
*
|
||||
* Locations are suitable to be loaded by spring's getResource method.
|
||||
*
|
||||
*/
|
||||
public class LicenseResourceComponent
|
||||
{
|
||||
public LicenseResourceComponent()
|
||||
{
|
||||
}
|
||||
|
||||
private String externalLicenseLocation = "*.lic";
|
||||
private String embeddedLicenseLocation = "/WEB-INF/alfresco/license/*.lic";
|
||||
private String sharedLicenseLocation = "classpath*:/alfresco/extension/license/*.lic";
|
||||
|
||||
public void setExternalLicenseLocation(String externalLicenseLocation)
|
||||
{
|
||||
this.externalLicenseLocation = externalLicenseLocation;
|
||||
}
|
||||
public String getExternalLicenseLocation()
|
||||
{
|
||||
return externalLicenseLocation;
|
||||
}
|
||||
public void setEmbeddedLicenseLocation(String embeddedLicenseLocation)
|
||||
{
|
||||
this.embeddedLicenseLocation = embeddedLicenseLocation;
|
||||
}
|
||||
public String getEmbeddedLicenseLocation()
|
||||
{
|
||||
return embeddedLicenseLocation;
|
||||
}
|
||||
public void setSharedLicenseLocation(String sharedLicenseLocation)
|
||||
{
|
||||
this.sharedLicenseLocation = sharedLicenseLocation;
|
||||
}
|
||||
public String getSharedLicenseLocation()
|
||||
{
|
||||
return sharedLicenseLocation;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user