List of usage examples for java.lang Module getName
public String getName()
From source file:de.juwimm.cms.content.modules.ModuleFactoryStandardImpl.java
/** * Creates a {@link Module} and configures it with all information taken from the mandator's dcf. * /*from w w w .ja v a 2 s.co m*/ * @param dcfelement the randomly named element containing the {@code dcfconfig} element * @param contentdata XML content for the module (the way TIZZIT saves it) * * @see de.juwimm.cms.content.modules.ModuleFactory#getModuleInstance(org.w3c.dom.Element, org.w3c.dom.Node) */ public Module getModuleInstance(Element dcfElement, Node contentdata) { Module module = null; String classname = ""; List<String> jarClassPath = new ArrayList<String>(); try { classname = XercesHelper.getNodeValue(dcfElement, "./dcfConfig/classname"); Iterator it = XercesHelper.findNodes(dcfElement, "./dcfConfig/classpath/jar"); while (it.hasNext()) { Node node = (Node) it.next(); jarClassPath.add(XercesHelper.getNodeValue(node)); } module = getModuleInstanceUnconfigured(classname, jarClassPath); String label = dcfElement.getAttribute("label"); String description = dcfElement.getAttribute("description"); String dcfname = dcfElement.getAttribute("dcfname"); String mandatory = XercesHelper.getNodeValue(dcfElement, "./dcfConfig/mandatory"); module.setLabel(label); module.setDescription(description); module.setName(dcfname); if (mandatory.equals("true")) { module.setMandatory(true); } else { module.setMandatory(false); } // Fill the custom properties for this dcfmodule explicit for this DCF Iterator ni = XercesHelper.findNodes(dcfElement, "./dcfConfig/property"); setCustomProperties(module, ni); if (module instanceof Iteration) { Node itEl = XercesHelper.findNode(dcfElement, "./dcfConfig/iterationElements"); ((Iteration) module).setIterationElements(itEl); } //Load initial config if there is no current content Node ndeInitialContent = XercesHelper.findNode(dcfElement, "./dcfInitial"); if (ndeInitialContent != null) { htInitialContent.put(module.getName(), ndeInitialContent); } if (contentdata == null) { contentdata = ndeInitialContent; } if (contentdata != null) { module.setProperties(contentdata); } } catch (Exception exe) { log.error("Error getting Module instance", exe); } this.htModules.put(module.getName(), module); return module; }
From source file:com.headwire.aem.tooling.intellij.communication.ServerConnectionManager.java
public boolean checkModule(@NotNull OsgiClient osgiClient, @NotNull final Module module) { boolean ret = true; try {//from w ww .j a v a2 s . c o m if (module.isPartOfBuild()) { // Check Binding if (checkBinding(module.getParent(), new ProgressHandlerImpl("Check Bindings"))) { UnifiedModule unifiedModule = module.getUnifiedModule(); if (unifiedModule != null) { String moduleName = unifiedModule.getName(); String symbolicName = unifiedModule.getSymbolicName(); String version = unifiedModule.getVersion(); version = checkBundleVersion(version); updateModuleStatus(module, ServerConfiguration.SynchronizationStatus.checking); if (module.isOSGiBundle()) { //AS TODO: This looks like OSGi Symbolic Name Version remoteVersion = osgiClient.getBundleVersion(module.getSymbolicName()); // If not remote Version is found there is a chance that the Felix Bundle did change // the symbolic names and here we test that and inform the user about it if (remoteVersion == null) { // If this is Maven and the last part of the package is also used at the beginning of the Artifact Id if (unifiedModule.isMavenBased() && !module.isIgnoreSymbolicNameMismatch()) { MavenProject mavenProject = moduleManager.getMavenProject(unifiedModule); if (mavenProject != null) { String groupId = mavenProject.getMavenId().getGroupId(); String artifactId = mavenProject.getMavenId().getArtifactId(); int index = groupId.lastIndexOf('.'); String lastPackage = groupId.substring(index > 0 ? index + 1 : 0); if (artifactId.startsWith(lastPackage)) { WaitableRunner<AtomicInteger> runner = new WaitableRunner<AtomicInteger>() { private AtomicInteger response = new AtomicInteger(1); @Override public boolean isAsynchronous() { return true; } @Override public AtomicInteger getResponse() { return response; } @Override public void run() { int selection = messageManager.showAlertWithOptions( NotificationType.WARNING, "module.check.possible.symbolic.name.mismatch", module.getSymbolicName()); getResponse().set(selection); } }; com.headwire.aem.tooling.intellij.util.ExecutionUtil.runAndWait(runner); if (runner.getResponse().get() == 0) { // If ignore is selected then save it on that moduleL module.setIgnoreSymbolicNameMismatch(true); } } } } } Version localVersion = new Version(version); messageManager.sendDebugNotification("debug.check.osgi.module", moduleName, symbolicName, remoteVersion, localVersion); boolean moduleUpToDate = remoteVersion != null && remoteVersion.compareTo(localVersion) >= 0; Object state = BundleStateHelper.getBundleState(module); messageManager.sendDebugNotification("debug.bundle.module.state", module.getName(), state); if (remoteVersion == null) { // Mark as not deployed yet updateModuleStatus(module, ServerConfiguration.SynchronizationStatus.notDeployed); ret = false; } else if (moduleUpToDate) { // Mark as synchronized updateModuleStatus(module, ServerConfiguration.SynchronizationStatus.upToDate); } else { // Mark as out of date updateModuleStatus(module, ServerConfiguration.SynchronizationStatus.outdated); ret = false; } } else if (module.isSlingPackage()) { long lastModificationTimestamp = getLastModificationTimestamp(module); long moduleModificationTimestamp = module.getLastModificationTimestamp(); if (lastModificationTimestamp > moduleModificationTimestamp) { updateModuleStatus(module, ServerConfiguration.SynchronizationStatus.outdated); ret = false; } else { updateModuleStatus(module, ServerConfiguration.SynchronizationStatus.upToDate); } } else { updateModuleStatus(module, ServerConfiguration.SynchronizationStatus.unsupported); } } else { updateModuleStatus(module, ServerConfiguration.SynchronizationStatus.failed); ret = false; } } else { updateModuleStatus(module, ServerConfiguration.SynchronizationStatus.failed); ret = false; } } else { updateModuleStatus(module, ServerConfiguration.SynchronizationStatus.excluded); } } catch (OsgiClientException e1) { // Mark connection as failed updateModuleStatus(module, ServerConfiguration.SynchronizationStatus.failed); ret = false; } return ret; }