use of com.liferay.ide.server.core.portal.PortalBundleFactory in project liferay-ide by liferay.
the class ServerUtil method getPortalBundle.
public static PortalBundle getPortalBundle(IProject project) throws CoreException {
SDK sdk = SDKUtil.getSDKFromProjectDir(project.getLocation().toFile());
if (sdk == null || !sdk.validate().isOK()) {
return null;
}
final Map<String, Object> appServerProperties = sdk.getBuildProperties();
final String appServerType = (String) (appServerProperties.get("app.server.type"));
PortalBundleFactory factory = LiferayServerCore.getPortalBundleFactories(appServerType);
if (factory != null) {
final IPath path = factory.canCreateFromPath(appServerProperties);
if (path != null) {
PortalBundle bundle = factory.create(path);
return bundle;
}
}
return null;
}
use of com.liferay.ide.server.core.portal.PortalBundleFactory in project liferay-ide by liferay.
the class LiferayServerCore method getPortalBundleFactories.
public static PortalBundleFactory[] getPortalBundleFactories() {
if (portalBundleFactories == null) {
final IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(PortalBundleFactory.EXTENSION_ID);
try {
final List<PortalBundleFactory> bundleFactories = new ArrayList<PortalBundleFactory>();
for (IConfigurationElement element : elements) {
final Object o = element.createExecutableExtension("class");
if (o instanceof PortalBundleFactory) {
AbstractPortalBundleFactory portalBundleFactory = (AbstractPortalBundleFactory) o;
portalBundleFactory.setBundleFactoryType(element.getAttribute("type"));
bundleFactories.add(portalBundleFactory);
}
}
portalBundleFactories = bundleFactories.toArray(new PortalBundleFactory[0]);
} catch (Exception e) {
// $NON-NLS-1$
logError("Unable to get PortalBundleFactory extensions", e);
}
}
return portalBundleFactories;
}
Aggregations