From 29c0f8573f257d506f814e8edc0fc74176950230 Mon Sep 17 00:00:00 2001 From: Pavel Vlasov Date: Sun, 18 May 2014 03:12:39 -0400 Subject: [PATCH] Commit all changes before repo transfer. --- org.nasdanika.cdo.h2/META-INF/MANIFEST.MF | 2 +- org.nasdanika.cdo.h2/pom.xml | 2 +- org.nasdanika.cdo/META-INF/MANIFEST.MF | 5 +- org.nasdanika.cdo/plugin.xml | 83 +++++++- org.nasdanika.cdo/pom.xml | 2 +- .../org/nasdanika/cdo/EAttributeClosure.java | 12 +- .../org/nasdanika/cdo/EReferenceClosure.java | 14 +- .../cdo/EStructuralFeatureClosure.java | 2 + .../nasdanika/cdo/util/NasdanikaCDOUtil.java | 57 ++++++ .../CDOTransactionContextRouteComponent.java | 1 + .../web/CDOTransactionHttpContextImpl.java | 7 +- ...CDOViewContextAutocloseRouteComponent.java | 13 +- .../cdo/web/CDOViewHttpContextImpl.java | 52 +---- ...ResourceFolderToHTMLRendererConverter.java | 53 +++++ .../CDOResourceToHTMLRendererConverter.java | 61 ++++++ .../html/CDOViewToHTMLRendererConverter.java | 56 +++++- ...tributeClosureToHTMLRendererConverter.java | 43 ++++ .../html/EClassToHTMLRendererConverter.java | 189 ++++++++++++++++++ .../ENamedElementToHTMLRendererConverter.java | 13 ++ .../html/EObjectToHTMLRendererConverter.java | 135 +++++++++++++ .../html/EPackageToHTMLRendererConverter.java | 101 ++++++++++ ...ferenceClosureToHTMLRendererConverter.java | 44 ++++ ...ucturalFeatureToHTMLRendererConverter.java | 13 ++ .../CDOResourcePathResolver.java | 23 +++ .../EClassifierPathResolver.java | 17 ++ .../EObjectPathResolver.java | 52 +++++ .../EPackagePathResolver.java | 36 ++++ ...EStructuralFeatureClosurePathResolver.java | 21 ++ ... CDOResourceFolderHtmlExtensionRoute.java} | 2 +- .../web/routes/CDOResourceFolderRoute.java | 39 ++-- .../cdo/web/routes/CDOResourceRoute.java | 51 +++-- .../web/routes/CDOViewJsonExtensionRoute.java | 11 +- .../cdo/web/routes/CDOViewRoute.java | 50 +++-- .../web/routes/EAttributeClosureRoute.java | 67 +++++++ .../cdo/web/routes/EObjectRoute.java | 71 +++++++ .../cdo/web/routes/EObjectXMIExportRoute.java | 81 ++++++++ .../cdo/web/routes/EPackageRoute.java | 50 +++-- .../web/routes/EReferenceClosureRoute.java | 61 ++++++ .../cdo/web/routes/HtmlExtensionGetRoute.java | 46 +++++ org.nasdanika.core.tests/META-INF/MANIFEST.MF | 2 +- org.nasdanika.core.tests/pom.xml | 2 +- org.nasdanika.core/META-INF/MANIFEST.MF | 2 +- org.nasdanika.core/pom.xml | 2 +- .../nasdanika/core/NasdanikaException.java | 21 ++ .../META-INF/MANIFEST.MF | 6 +- org.nasdanika.examples.bank.app/pom.xml | 2 +- .../nasdanika/examples/bank/app/AppRoute.java | 17 +- .../examples/bank/app/HomeRoute.java | 2 +- .../META-INF/MANIFEST.MF | 4 +- org.nasdanika.examples.bank/model/bank.ecore | 6 + .../model/bank.genmodel | 2 +- org.nasdanika.examples.bank/pom.xml | 2 +- .../nasdanika/examples/bank/BankPackage.java | 5 + .../examples/bank/SystemOfRecords.java | 4 + .../examples/bank/impl/BankPackageImpl.java | 26 +++ .../examples/bank/impl/CreditCardImpl.java | 9 + .../bank/impl/SystemOfRecordsImpl.java | 3 + org.nasdanika.examples.feature/pom.xml | 2 +- org.nasdanika.feature/feature.xml | 97 ++++++++- org.nasdanika.feature/pom.xml | 2 +- org.nasdanika.html.feature/.classpath | 26 +++ org.nasdanika.html.feature/.gitignore | 1 + org.nasdanika.html.feature/.project | 29 +++ .../.settings/org.eclipse.jdt.core.prefs | 5 + .../.settings/org.eclipse.m2e.core.prefs | 4 + org.nasdanika.parent/pom.xml | 6 +- org.nasdanika.repository/category.xml | 3 + org.nasdanika.repository/pom.xml | 2 +- .../feature.xml | 2 +- .../pom.xml | 2 +- org.nasdanika.thirdparty/.gitignore | 1 + org.nasdanika.thirdparty/pom.xml | 103 ++++++++++ .../META-INF/MANIFEST.MF | 2 +- org.nasdanika.transaction/pom.xml | 2 +- org.nasdanika.web/META-INF/MANIFEST.MF | 7 +- org.nasdanika.web/plugin.xml | 1 + org.nasdanika.web/pom.xml | 2 +- .../schema/object_path_resolver.exsd | 112 +++++++++++ .../web/CompositeObjectPathResolver.java | 62 ++++++ .../src/org/nasdanika/web/ContextImpl.java | 70 ++++++- .../org/nasdanika/web/ExtensionManager.java | 44 +++- .../org/nasdanika/web/HttpContextImpl.java | 114 ++++++++++- .../nasdanika/web/MapObjectPathResolver.java | 21 ++ .../org/nasdanika/web/ObjectPathResolver.java | 21 ++ .../src/org/nasdanika/web/RoutingServlet.java | 10 +- .../src/org/nasdanika/web/TraceEntry.java | 14 ++ .../src/org/nasdanika/web/WebContext.java | 30 ++- .../feature.xml | 2 +- org.nasdankia.server.jetty.feature/pom.xml | 5 +- pom.xml | 3 +- 90 files changed, 2323 insertions(+), 239 deletions(-) create mode 100644 org.nasdanika.cdo/src/org/nasdanika/cdo/util/NasdanikaCDOUtil.java create mode 100644 org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/CDOResourceFolderToHTMLRendererConverter.java create mode 100644 org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/CDOResourceToHTMLRendererConverter.java create mode 100644 org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/EAttributeClosureToHTMLRendererConverter.java create mode 100644 org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/EClassToHTMLRendererConverter.java create mode 100644 org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/ENamedElementToHTMLRendererConverter.java create mode 100644 org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/EObjectToHTMLRendererConverter.java create mode 100644 org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/EPackageToHTMLRendererConverter.java create mode 100644 org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/EReferenceClosureToHTMLRendererConverter.java create mode 100644 org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/EStructuralFeatureToHTMLRendererConverter.java create mode 100644 org.nasdanika.cdo/src/org/nasdanika/cdo/web/objectpathresolvers/CDOResourcePathResolver.java create mode 100644 org.nasdanika.cdo/src/org/nasdanika/cdo/web/objectpathresolvers/EClassifierPathResolver.java create mode 100644 org.nasdanika.cdo/src/org/nasdanika/cdo/web/objectpathresolvers/EObjectPathResolver.java create mode 100644 org.nasdanika.cdo/src/org/nasdanika/cdo/web/objectpathresolvers/EPackagePathResolver.java create mode 100644 org.nasdanika.cdo/src/org/nasdanika/cdo/web/objectpathresolvers/EStructuralFeatureClosurePathResolver.java rename org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/{CDOViewHtmlExtensionRoute.java => CDOResourceFolderHtmlExtensionRoute.java} (94%) create mode 100644 org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/EAttributeClosureRoute.java create mode 100644 org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/EObjectRoute.java create mode 100644 org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/EObjectXMIExportRoute.java create mode 100644 org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/EReferenceClosureRoute.java create mode 100644 org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/HtmlExtensionGetRoute.java create mode 100644 org.nasdanika.core/src/org/nasdanika/core/NasdanikaException.java create mode 100644 org.nasdanika.html.feature/.classpath create mode 100644 org.nasdanika.html.feature/.gitignore create mode 100644 org.nasdanika.html.feature/.project create mode 100644 org.nasdanika.html.feature/.settings/org.eclipse.jdt.core.prefs create mode 100644 org.nasdanika.html.feature/.settings/org.eclipse.m2e.core.prefs create mode 100644 org.nasdanika.thirdparty/.gitignore create mode 100644 org.nasdanika.thirdparty/pom.xml create mode 100644 org.nasdanika.web/schema/object_path_resolver.exsd create mode 100644 org.nasdanika.web/src/org/nasdanika/web/CompositeObjectPathResolver.java create mode 100644 org.nasdanika.web/src/org/nasdanika/web/MapObjectPathResolver.java create mode 100644 org.nasdanika.web/src/org/nasdanika/web/ObjectPathResolver.java create mode 100644 org.nasdanika.web/src/org/nasdanika/web/TraceEntry.java diff --git a/org.nasdanika.cdo.h2/META-INF/MANIFEST.MF b/org.nasdanika.cdo.h2/META-INF/MANIFEST.MF index d6d642cb..57f32dde 100644 --- a/org.nasdanika.cdo.h2/META-INF/MANIFEST.MF +++ b/org.nasdanika.cdo.h2/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Nasdanika CDO H2 Repository Provider Bundle-SymbolicName: org.nasdanika.cdo.h2 -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 0.1.0.qualifier Bundle-Vendor: Nasdanika Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Require-Bundle: org.eclipse.net4j.db.h2;bundle-version="4.0.100", diff --git a/org.nasdanika.cdo.h2/pom.xml b/org.nasdanika.cdo.h2/pom.xml index 0dcfe484..6ed93932 100644 --- a/org.nasdanika.cdo.h2/pom.xml +++ b/org.nasdanika.cdo.h2/pom.xml @@ -5,7 +5,7 @@ org.nasdanika org.nasdanika.parent - 1.0.0-SNAPSHOT + 0.1.0-SNAPSHOT ../org.nasdanika.parent \ No newline at end of file diff --git a/org.nasdanika.cdo/META-INF/MANIFEST.MF b/org.nasdanika.cdo/META-INF/MANIFEST.MF index 1916bc1a..976b2798 100644 --- a/org.nasdanika.cdo/META-INF/MANIFEST.MF +++ b/org.nasdanika.cdo/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Nasdanika CDO components Bundle-SymbolicName: org.nasdanika.cdo;singleton:=true -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 0.1.0.qualifier Bundle-Vendor: Nasdanika Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Require-Bundle: org.eclipse.emf.cdo.server;bundle-version="4.1.1", @@ -13,7 +13,8 @@ Require-Bundle: org.eclipse.emf.cdo.server;bundle-version="4.1.1", org.eclipse.emf.cdo.net4j;bundle-version="4.1.0", org.eclipse.emf.cdo, org.json;bundle-version="1.0.0", - org.nasdanika.web;bundle-version="1.0.0";visibility:=reexport + org.nasdanika.web;bundle-version="0.1.0";visibility:=reexport, + org.nasdanika.thirdparty;bundle-version="1.0.0" Export-Package: org.nasdanika.cdo, org.nasdanika.cdo.convert, org.nasdanika.cdo.web, diff --git a/org.nasdanika.cdo/plugin.xml b/org.nasdanika.cdo/plugin.xml index 3fbaf76a..8c69497a 100644 --- a/org.nasdanika.cdo/plugin.xml +++ b/org.nasdanika.cdo/plugin.xml @@ -40,10 +40,31 @@ target="org.eclipse.emf.cdo.view.CDOView"> + target="java.lang.Object"> + + + + + + + + @@ -59,6 +80,64 @@ source="org.eclipse.emf.cdo.view.CDOView" target="org.nasdanika.web.html.HTMLRenderer"> + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/org.nasdanika.cdo/pom.xml b/org.nasdanika.cdo/pom.xml index 5dc548f5..84b99823 100644 --- a/org.nasdanika.cdo/pom.xml +++ b/org.nasdanika.cdo/pom.xml @@ -5,7 +5,7 @@ org.nasdanika org.nasdanika.parent - 1.0.0-SNAPSHOT + 0.1.0-SNAPSHOT ../org.nasdanika.parent \ No newline at end of file diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/EAttributeClosure.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/EAttributeClosure.java index 19e13ee1..13339d82 100644 --- a/org.nasdanika.cdo/src/org/nasdanika/cdo/EAttributeClosure.java +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/EAttributeClosure.java @@ -3,19 +3,19 @@ import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EObject; -public class EAttributeClosure implements EStructuralFeatureClosure { +public class EAttributeClosure implements EStructuralFeatureClosure { private EAttribute attr; - private EObject obj; + private O obj; - public EAttributeClosure(EObject obj, EAttribute attr) { + public EAttributeClosure(O obj, EAttribute attr) { super(); this.obj = obj; this.attr = attr; } @Override - public EObject getObject() { + public O getObject() { return obj; } @@ -24,5 +24,9 @@ public EAttribute getFeature() { return attr; } + @Override + public Object getValue() { + return obj.eGet(attr); + } } diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/EReferenceClosure.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/EReferenceClosure.java index b2eb1a27..38573162 100644 --- a/org.nasdanika.cdo/src/org/nasdanika/cdo/EReferenceClosure.java +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/EReferenceClosure.java @@ -3,19 +3,19 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EReference; -public class EReferenceClosure implements EStructuralFeatureClosure { +public class EReferenceClosure implements EStructuralFeatureClosure { private EReference ref; - private EObject obj; + private O obj; - public EReferenceClosure(EObject obj, EReference ref) { + public EReferenceClosure(O obj, EReference ref) { super(); this.obj = obj; this.ref = ref; } @Override - public EObject getObject() { + public O getObject() { return obj; } @@ -24,5 +24,9 @@ public EReference getFeature() { return ref; } - + @Override + public Object getValue() { + return obj.eGet(ref); + } + } diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/EStructuralFeatureClosure.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/EStructuralFeatureClosure.java index 538e3b3d..1b9a3077 100644 --- a/org.nasdanika.cdo/src/org/nasdanika/cdo/EStructuralFeatureClosure.java +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/EStructuralFeatureClosure.java @@ -15,5 +15,7 @@ public interface EStructuralFeatureClosure"+StringEscapeUtils.escapeHtml4(doc)+""; + } + + /** + * Returns first sentence (till first dot) of the documentation. + * @param modelElement + * @return + */ + public static String getSummary(EModelElement modelElement) { + String doc = EcoreUtil.getDocumentation(modelElement); + if (doc==null) { + return " "; + } + String trimmedDoc = doc.trim(); + if (trimmedDoc.startsWith(HTML_OPEN_TAG) && trimmedDoc.endsWith(HTML_CLOSE_TAG)) { + String htmlDoc = trimmedDoc.substring(HTML_OPEN_TAG.length(), trimmedDoc.length()-HTML_CLOSE_TAG.length()); + int idx = htmlDoc.indexOf("."); + return idx==-1 ? htmlDoc : htmlDoc.substring(0, idx+1); + } + + String escapedDoc = StringEscapeUtils.escapeHtml4(doc); + int idx = escapedDoc.indexOf("."); + return idx==-1 ? "
"+escapedDoc+"
" : escapedDoc.substring(0, idx+1); + } + +} diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/CDOTransactionContextRouteComponent.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/CDOTransactionContextRouteComponent.java index 50e1d1f7..98e10538 100644 --- a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/CDOTransactionContextRouteComponent.java +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/CDOTransactionContextRouteComponent.java @@ -27,6 +27,7 @@ public Action execute(WebContext context) throws Exception { httpContext.getPath(), httpContext.getTarget(), httpContext.getExtensionManager(), + null, httpContext.getRequest(), httpContext.getResponse(), httpContext.getContextURL(), diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/CDOTransactionHttpContextImpl.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/CDOTransactionHttpContextImpl.java index bafe1cfd..949538bb 100644 --- a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/CDOTransactionHttpContextImpl.java +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/CDOTransactionHttpContextImpl.java @@ -1,5 +1,7 @@ package org.nasdanika.cdo.web; +import java.util.List; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -7,6 +9,7 @@ import org.nasdanika.cdo.CDOTransactionContext; import org.nasdanika.web.ExtensionManager; import org.nasdanika.web.HttpContextImpl; +import org.nasdanika.web.TraceEntry; import org.nasdanika.web.WebContext; public class CDOTransactionHttpContextImpl extends HttpContextImpl implements CDOTransactionHttpContext { @@ -18,12 +21,13 @@ public CDOTransactionHttpContextImpl( String[] path, Object target, ExtensionManager extensionManager, + List pathTrace, HttpServletRequest req, HttpServletResponse resp, String contextURL, CDOTransactionContext transactionContext) throws Exception { - super(principal, path, target, extensionManager, req, resp, contextURL); + super(principal, path, target, extensionManager, pathTrace, req, resp, contextURL); this.transactionContext = transactionContext; } @@ -34,6 +38,7 @@ protected WebContext createSubContext(String[] subPath, Object target) throws Ex subPath, target, getExtensionManager(), + getPathTrace(), getRequest(), getResponse(), subContextURL(subPath, true), diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/CDOViewContextAutocloseRouteComponent.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/CDOViewContextAutocloseRouteComponent.java index 8fb357aa..8a8679f8 100644 --- a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/CDOViewContextAutocloseRouteComponent.java +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/CDOViewContextAutocloseRouteComponent.java @@ -36,15 +36,26 @@ public Object execute() throws Exception { protected CDOViewHttpContextImpl mergeContexts(WebContext webContext, CDOViewContext context) throws Exception { if (webContext instanceof HttpContextImpl) { HttpContextImpl httpContext = (HttpContextImpl) webContext; - return new CDOViewHttpContextImpl( + CDOViewHttpContextImpl mergedContext = new CDOViewHttpContextImpl( httpContext.getPrincipal(), httpContext.getPath(), httpContext.getTarget(), httpContext.getExtensionManager(), + null, httpContext.getRequest(), httpContext.getResponse(), httpContext.getContextURL(), context); + + String viewPath = httpContext.getPath()[0]; + int idx = viewPath.lastIndexOf('.'); + if (idx!=-1) { + viewPath = viewPath.substring(0, idx); + } + + mergedContext.getRootObjectsPaths().put(context.getView(), httpContext.getContextURL()+"/"+viewPath); + + return mergedContext; } throw new IllegalArgumentException("Unsupported context type: "+context); } diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/CDOViewHttpContextImpl.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/CDOViewHttpContextImpl.java index e3efe5fc..6f45c9ee 100644 --- a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/CDOViewHttpContextImpl.java +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/CDOViewHttpContextImpl.java @@ -1,17 +1,15 @@ package org.nasdanika.cdo.web; +import java.util.List; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.eclipse.emf.cdo.CDOObject; -import org.eclipse.emf.cdo.eresource.CDOResource; -import org.eclipse.emf.cdo.eresource.CDOResourceFolder; -import org.eclipse.emf.cdo.eresource.CDOResourceNode; import org.eclipse.emf.cdo.view.CDOView; -import org.eclipse.emf.ecore.EObject; import org.nasdanika.cdo.CDOViewContext; import org.nasdanika.web.ExtensionManager; import org.nasdanika.web.HttpContextImpl; +import org.nasdanika.web.TraceEntry; import org.nasdanika.web.WebContext; public class CDOViewHttpContextImpl extends HttpContextImpl implements CDOViewHttpContext { @@ -23,26 +21,30 @@ public CDOViewHttpContextImpl( String[] path, Object target, ExtensionManager extensionManager, + List pathTrace, HttpServletRequest req, HttpServletResponse resp, String contextURL, CDOViewContext viewContext) throws Exception { - super(principal, path, target, extensionManager, req, resp, contextURL); + super(principal, path, target, extensionManager, pathTrace, req, resp, contextURL); this.viewContext = viewContext; } @Override protected WebContext createSubContext(String[] subPath, Object target) throws Exception { - return new CDOViewHttpContextImpl( + CDOViewHttpContextImpl subContext = new CDOViewHttpContextImpl( getPrincipal(), subPath, target, getExtensionManager(), + getPathTrace(), getRequest(), getResponse(), subContextURL(subPath, true), viewContext); + subContext.getRootObjectsPaths().putAll(getRootObjectsPaths()); + return subContext; } @Override @@ -55,41 +57,5 @@ public void close() throws Exception { viewContext.close(); // TODO - tracking and closing of sub-contexts. } - - @Override - public String getObjectURL(Object object) { - for (CDOResourceNode e: viewContext.getView().getElements()) { - String ret = getObjectURL(e, getContextURL(), object); - if (ret!=null) { - return ret; - } - } - return super.getObjectURL(object); - } - - private String getObjectURL(CDOResourceNode e, String contextURL, Object object) { - if (e==object) { - return contextURL+"/"+e.getName(); - } - if (e instanceof CDOResourceFolder) { - for (CDOResourceNode n: ((CDOResourceFolder) e).getNodes()) { - String ret = getObjectURL(n, contextURL+"/"+e.getName(), object); - if (ret!=null) { - return ret; - } - } - return null; - } - - if (e instanceof CDOResource - && object instanceof CDOObject - && ((CDOObject) object).cdoResource()==e) { - - CDOResource res = ((CDOObject) object).cdoResource(); - return contextURL+"/"+res.getURIFragment((EObject) object); - } - - return null; - } } diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/CDOResourceFolderToHTMLRendererConverter.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/CDOResourceFolderToHTMLRendererConverter.java new file mode 100644 index 00000000..63563a00 --- /dev/null +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/CDOResourceFolderToHTMLRendererConverter.java @@ -0,0 +1,53 @@ +package org.nasdanika.cdo.web.html; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.StringEscapeUtils; +import org.eclipse.emf.cdo.eresource.CDOResourceFolder; +import org.eclipse.emf.cdo.eresource.CDOResourceNode; +import org.nasdanika.core.Converter; +import org.nasdanika.html.HTMLFactory; +import org.nasdanika.web.HttpContext; +import org.nasdanika.web.WebContext; +import org.nasdanika.web.html.HTMLRenderer; + +public class CDOResourceFolderToHTMLRendererConverter implements Converter { + + @Override + public void close() throws Exception { + // NOP + + } + + @Override + public HTMLRenderer convert( + final CDOResourceFolder source, + Class target, + WebContext context) throws Exception { + + return new HTMLRenderer() { + + @Override + public String render(WebContext context, String profile, Map environment) throws Exception { + List nodes = new ArrayList<>(); + HTMLFactory htmlFactory = context.getHTMLFactory(); + for (CDOResourceNode e: source.getNodes()) { + String pe = context.getPath()[0]; + int didx = pe.lastIndexOf('.'); + if (didx!=-1) { + pe = pe.substring(0, didx); + } + if (context instanceof HttpContext) { + nodes.add(htmlFactory.routeLink(null, ((HttpContext) context).getObjectPath(e)+".html", StringEscapeUtils.escapeHtml4(e.getName())).toString()); + } + } + + return htmlFactory.ul(nodes).toString(); + } + }; + } + + +} diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/CDOResourceToHTMLRendererConverter.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/CDOResourceToHTMLRendererConverter.java new file mode 100644 index 00000000..66e66342 --- /dev/null +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/CDOResourceToHTMLRendererConverter.java @@ -0,0 +1,61 @@ +package org.nasdanika.cdo.web.html; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.StringEscapeUtils; +import org.eclipse.emf.cdo.eresource.CDOResource; +import org.eclipse.emf.ecore.EObject; +import org.nasdanika.core.Converter; +import org.nasdanika.html.Breadcrumbs; +import org.nasdanika.html.HTMLFactory; +import org.nasdanika.web.HttpContext; +import org.nasdanika.web.TraceEntry; +import org.nasdanika.web.WebContext; +import org.nasdanika.web.html.HTMLRenderer; + +public class CDOResourceToHTMLRendererConverter implements Converter { + + @Override + public void close() throws Exception { + // NOP + + } + + @Override + public HTMLRenderer convert( + final CDOResource source, + Class target, + WebContext context) throws Exception { + + return new HTMLRenderer() { + + @Override + public String render(WebContext context, String profile, Map environment) throws Exception { + HTMLFactory htmlFactory = context.getHTMLFactory(); + Breadcrumbs breadcrumbs = htmlFactory.breadcrumbs(); + for (TraceEntry te: context.getPathTrace()) { + breadcrumbs.item(te.getPath(), te.getDisplayName()); + } + breadcrumbs.item(null, StringEscapeUtils.escapeHtml4(source.getName())); + + List contents = new ArrayList<>(); + for (EObject e: source.eContents()) { + String pe = context.getPath()[0]; + int didx = pe.lastIndexOf('.'); + if (didx!=-1) { + pe = pe.substring(0, didx); + } + if (context instanceof HttpContext) { + contents.add(htmlFactory.routeLink(null, ((HttpContext) context).getObjectPath(e)+".html", context.toHTML(e, "label", null)).toString()); + } + } + + return breadcrumbs.toString()+htmlFactory.ul(contents).toString(); + } + }; + } + + +} diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/CDOViewToHTMLRendererConverter.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/CDOViewToHTMLRendererConverter.java index 487f0727..b2677ef2 100644 --- a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/CDOViewToHTMLRendererConverter.java +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/CDOViewToHTMLRendererConverter.java @@ -1,14 +1,25 @@ package org.nasdanika.cdo.web.html; import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; import java.util.List; import java.util.Map; +import org.apache.commons.lang3.StringEscapeUtils; +import org.eclipse.emf.cdo.common.model.CDOPackageInfo; import org.eclipse.emf.cdo.eresource.CDOResourceNode; import org.eclipse.emf.cdo.view.CDOView; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.nasdanika.cdo.util.NasdanikaCDOUtil; import org.nasdanika.core.Converter; import org.nasdanika.html.HTMLFactory; +import org.nasdanika.html.HTMLFactory.Glyphicon; +import org.nasdanika.html.Table; +import org.nasdanika.html.Table.Row; import org.nasdanika.html.Tabs; +import org.nasdanika.html.UIElement.Color; import org.nasdanika.web.HttpContext; import org.nasdanika.web.WebContext; import org.nasdanika.web.html.HTMLRenderer; @@ -40,14 +51,53 @@ public String render(WebContext context, String profile, Map env pe = pe.substring(0, didx); } if (context instanceof HttpContext) { - elements.add(htmlFactory.routeLink(null, ((HttpContext) context).getObjectURL(e)+".html", e.getName()).toString()); // TODO - escape names + elements.add(htmlFactory.routeLink(null, ((HttpContext) context).getObjectPath(e)+".html", e.getName()).toString()); // TODO - escape names } } Tabs tabs = htmlFactory.tabs(); tabs.tab("Elements", null, htmlFactory.ul(elements)); - tabs.ajaxTab("Packages", null, "test.html"); // TODO - return htmlFactory.fragment(htmlFactory.tag("h4", "CDO View"), tabs).toString(); + List packageInfos = new ArrayList<>(); + for (CDOPackageInfo pi: source.getSession().getPackageRegistry().getPackageInfos()) { + packageInfos.add(pi); + } + + List sortedPackageInfos = new ArrayList<>(packageInfos); + Collections.sort(sortedPackageInfos, new Comparator() { + + @Override + public int compare(CDOPackageInfo o1, CDOPackageInfo o2) { + if (o1==o2) { + return 0; + } + int ncmp = o1.getEPackage().getName().compareTo(o2.getEPackage().getName()); + return ncmp==0 ? o1.getEPackage().getNsURI().compareTo(o2.getEPackage().getNsURI()) : ncmp; + } + }); + + Table packageTable = htmlFactory.table().bordered(); + Row headerRow = packageTable.row().background(Color.GRAY_LIGHTER); + headerRow.header("Name"); + headerRow.header("Namespace URI"); + headerRow.header("Documentation"); + headerRow.header("Core"); + headerRow.header("Res"); + headerRow.header("System"); + headerRow.header("Type"); + for (CDOPackageInfo pi: sortedPackageInfos) { + Row packageRow = packageTable.row(); + EPackage ePackage = pi.getEPackage(); + packageRow.cell(htmlFactory.routeLink("main", context.getObjectPath(ePackage)+".html", StringEscapeUtils.escapeHtml4(ePackage.getName()))); // TODO - link + packageRow.cell(StringEscapeUtils.escapeHtml4(ePackage.getNsURI())); + packageRow.cell(NasdanikaCDOUtil.getSummary(ePackage)); + packageRow.cell(pi.isCorePackage() ? htmlFactory.glyphicon(Glyphicon.ok) : " ").attribute("align", "center"); + packageRow.cell(pi.isResourcePackage() ? htmlFactory.glyphicon(Glyphicon.ok) : " ").attribute("align", "center"); + packageRow.cell(pi.isSystemPackage() ? htmlFactory.glyphicon(Glyphicon.ok) : " ").attribute("align", "center"); + packageRow.cell(pi.isTypePackage() ? htmlFactory.glyphicon(Glyphicon.ok) : " ").attribute("align", "center"); + } + tabs.tab("Packages", null, packageTable); // TODO + + return htmlFactory.fragment(htmlFactory.tag("h4", "CDO View"), tabs, htmlFactory.title("CDO View")).toString(); } }; } diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/EAttributeClosureToHTMLRendererConverter.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/EAttributeClosureToHTMLRendererConverter.java new file mode 100644 index 00000000..a9b98203 --- /dev/null +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/EAttributeClosureToHTMLRendererConverter.java @@ -0,0 +1,43 @@ +package org.nasdanika.cdo.web.html; + +import java.util.Map; + +import org.apache.commons.lang3.StringEscapeUtils; +import org.nasdanika.cdo.EAttributeClosure; +import org.nasdanika.core.Converter; +import org.nasdanika.html.Table; +import org.nasdanika.web.WebContext; +import org.nasdanika.web.html.HTMLRenderer; + +public class EAttributeClosureToHTMLRendererConverter implements Converter { + + @Override + public void close() throws Exception { + // TODO Auto-generated method stub + + } + + @Override + public HTMLRenderer convert(final EAttributeClosure source, Class target, WebContext context) throws Exception { + return new HTMLRenderer() { + + @Override + public String render(WebContext context, String profile, Map environment) throws Exception { + if ("label".equals(profile)) { + return StringEscapeUtils.escapeHtml4(source.getFeature().getName()); + } + if (source.getFeature().isMany()) { + Table data = context.getHTMLFactory().table().bordered(); + for (Object e: (Iterable) source.getValue()) { + data.row().cell(context.toHTML(e, "label", null)); + } + return data.toString(); + } + return context.toHTML(source.getValue(), null, null); + } + + }; + } + + +} diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/EClassToHTMLRendererConverter.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/EClassToHTMLRendererConverter.java new file mode 100644 index 00000000..b49e6bb2 --- /dev/null +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/EClassToHTMLRendererConverter.java @@ -0,0 +1,189 @@ +package org.nasdanika.cdo.web.html; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.StringEscapeUtils; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EOperation; +import org.eclipse.emf.ecore.EParameter; +import org.eclipse.emf.ecore.EReference; +import org.nasdanika.cdo.util.NasdanikaCDOUtil; +import org.nasdanika.core.Converter; +import org.nasdanika.html.Breadcrumbs; +import org.nasdanika.html.Fragment; +import org.nasdanika.html.HTMLFactory; +import org.nasdanika.html.HTMLFactory.Glyphicon; +import org.nasdanika.html.Table; +import org.nasdanika.html.Table.Row; +import org.nasdanika.html.Tag; +import org.nasdanika.html.UIElement.Color; +import org.nasdanika.html.UIElement.Style; +import org.nasdanika.web.TraceEntry; +import org.nasdanika.web.WebContext; +import org.nasdanika.web.html.HTMLRenderer; + +public class EClassToHTMLRendererConverter implements Converter { + + @Override + public void close() throws Exception { + // NOP + + } + + @Override + public HTMLRenderer convert( + final EClass source, + Class target, + WebContext context) throws Exception { + + return new HTMLRenderer() { + + @Override + public String render(WebContext context, String profile, Map environment) throws Exception { + if ("label".equals(profile)) { + return StringEscapeUtils.escapeHtml4(source.getName()); + } + + HTMLFactory htmlFactory = context.getHTMLFactory(); + Breadcrumbs breadcrumbs = htmlFactory.breadcrumbs(); + for (TraceEntry te: context.getPathTrace()) { + breadcrumbs.item(te.getPath(), te.getDisplayName()); + } + String sourceName = StringEscapeUtils.escapeHtml4(source.getName()); + breadcrumbs.item(null, sourceName); + + if (source.isInterface()) { + sourceName = "interface "+sourceName; + } + + Fragment body = htmlFactory.fragment( + htmlFactory.title("EClass "+source.getName()), + breadcrumbs, + htmlFactory.tag("h4", "EClass ", source.isAbstract() ? htmlFactory.tag("i", sourceName) : sourceName), + htmlFactory.tag("p", NasdanikaCDOUtil.getDocumentation(source))); + + if (!source.getESuperTypes().isEmpty()) { + Table scTable = htmlFactory.table().bordered(); + Row hRow = scTable.row().background(Color.GRAY_LIGHTER); + hRow.header("Name"); + hRow.header("Description"); + for (EClass st: source.getESuperTypes()) { + Row row = scTable.row(); + Tag classifierLink = htmlFactory.routeLink("main", context.getObjectPath(st)+".html", StringEscapeUtils.escapeHtml4(st.getName())); + row.cell(st.isAbstract() ? htmlFactory.tag("i", classifierLink) : classifierLink); + row.cell(NasdanikaCDOUtil.getSummary(st)); + } + body.content(htmlFactory.panel(Style.DEFAULT, "Supertypes", scTable, null)); + } + + // Known subtypes - scan package registry, name, package (rowspan with success highlighting), current package first + + // attributes + if (!source.getEAttributes().isEmpty()) { + Table aTable = htmlFactory.table().bordered(); + Row hRow = aTable.row().background(Color.GRAY_LIGHTER); + hRow.header("Name"); + hRow.header("Type"); + hRow.header("Many"); + hRow.header("Description"); + for (EAttribute a: source.getEAttributes()) { + Row row = aTable.row(); + row.cell(htmlFactory.routeLink("main", context.getObjectPath(a)+".html", StringEscapeUtils.escapeHtml4(a.getName()))); + if (a.getEType()!=null) { + row.cell(htmlFactory.routeLink("main", context.getObjectPath(a.getEType())+".html", StringEscapeUtils.escapeHtml4(a.getEType().getName()))); + } else { + row.cell(" "); // TODO - generic type. + } + row.cell(a.isMany() ? htmlFactory.glyphicon(Glyphicon.ok) : " ").attribute("align", "center"); + row.cell(NasdanikaCDOUtil.getSummary(a)); + } + body.content(htmlFactory.panel(Style.DEFAULT, "Attributes", aTable, null)); + } + + // references + if (!source.getEReferences().isEmpty()) { + Table rTable = htmlFactory.table().bordered(); + Row hRow = rTable.row().background(Color.GRAY_LIGHTER); + hRow.header("Name"); + hRow.header("Type"); + hRow.header("Many"); + hRow.header("Container"); + hRow.header("Containment"); + hRow.header("Opposite"); + hRow.header("Description"); + for (EReference r: source.getEReferences()) { + Row row = rTable.row(); + row.cell(htmlFactory.routeLink("main", context.getObjectPath(r)+".html", StringEscapeUtils.escapeHtml4(r.getName()))); + if (r.getEType()!=null) { + row.cell(htmlFactory.routeLink("main", context.getObjectPath(r.getEType())+".html", StringEscapeUtils.escapeHtml4(r.getEType().getName()))); + } else { + row.cell(" "); // TODO - generic type. + } + row.cell(r.isMany() ? htmlFactory.glyphicon(Glyphicon.ok) : " ").attribute("align", "center"); + row.cell(r.isContainer() ? htmlFactory.glyphicon(Glyphicon.ok) : " ").attribute("align", "center"); + row.cell(r.isContainment() ? htmlFactory.glyphicon(Glyphicon.ok) : " ").attribute("align", "center"); + if (r.getEOpposite()==null) { + row.cell(" "); + } else { + row.cell( + htmlFactory.routeLink("main", context.getObjectPath(r.getEOpposite().getEContainingClass())+".html", StringEscapeUtils.escapeHtml4(r.getEOpposite().getEContainingClass().getName())), + ".", + htmlFactory.routeLink("main", context.getObjectPath(r.getEOpposite())+".html", StringEscapeUtils.escapeHtml4(r.getEOpposite().getName()))); + } + row.cell(NasdanikaCDOUtil.getSummary(r)); + } + body.content("

", htmlFactory.panel(Style.DEFAULT, "References", rTable, null)); + } + + // operations + if (!source.getEOperations().isEmpty()) { + Table oTable = htmlFactory.table().bordered(); + Row hRow = oTable.row().background(Color.GRAY_LIGHTER); + hRow.header("Name"); + hRow.header("Return type"); + hRow.header("Many"); + hRow.header("Parameters"); + hRow.header("Exceptions"); + hRow.header("Description"); + for (EOperation op: source.getEOperations()) { + Row row = oTable.row(); + row.cell(htmlFactory.routeLink("main", context.getObjectPath(op)+".html", StringEscapeUtils.escapeHtml4(op.getName()))); + if (op.getEType()!=null) { + row.cell(htmlFactory.routeLink("main", context.getObjectPath(op.getEType())+".html", StringEscapeUtils.escapeHtml4(op.getEType().getName()))); + } else { + row.cell(" "); // TODO - generic type. + } + row.cell(op.isMany() ? htmlFactory.glyphicon(Glyphicon.ok) : " ").attribute("align", "center"); + + List params = new ArrayList<>(); + for (EParameter p: op.getEParameters()) { + params.add(htmlFactory.fragment( + htmlFactory.routeLink("main", context.getObjectPath(p)+".html", StringEscapeUtils.escapeHtml4(p.getName())), + " : ", + p.getEType()==null ? "void" : htmlFactory.routeLink("main", context.getObjectPath(p.getEType())+".html", StringEscapeUtils.escapeHtml4(p.getEType().getName())), + p.isMany() ? " *" : "")); + } + row.cell(htmlFactory.ol(params)); + + List exs = new ArrayList<>(); + for (EClassifier ex: op.getEExceptions()) { + params.add(htmlFactory.routeLink("main", context.getObjectPath(ex)+".html", StringEscapeUtils.escapeHtml4(ex.getName()))); + } + row.cell(htmlFactory.ul(exs)); + + row.cell(NasdanikaCDOUtil.getSummary(op)); + } + body.content("

", htmlFactory.panel(Style.DEFAULT, "Operations", oTable, null)); + } + + return body.toString(); + } + }; + } + + +} diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/ENamedElementToHTMLRendererConverter.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/ENamedElementToHTMLRendererConverter.java new file mode 100644 index 00000000..92fd432e --- /dev/null +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/ENamedElementToHTMLRendererConverter.java @@ -0,0 +1,13 @@ +package org.nasdanika.cdo.web.html; + +import org.apache.commons.lang3.StringEscapeUtils; +import org.eclipse.emf.ecore.ENamedElement; + +public class ENamedElementToHTMLRendererConverter extends EObjectToHTMLRendererConverter { + + @Override + protected String label(ENamedElement source) { + return StringEscapeUtils.escapeHtml4(source.getName()); + } + +} diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/EObjectToHTMLRendererConverter.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/EObjectToHTMLRendererConverter.java new file mode 100644 index 00000000..65dde2bc --- /dev/null +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/EObjectToHTMLRendererConverter.java @@ -0,0 +1,135 @@ +package org.nasdanika.cdo.web.html; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.StringEscapeUtils; +import org.apache.commons.lang3.StringUtils; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EModelElement; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.nasdanika.cdo.util.NasdanikaCDOUtil; +import org.nasdanika.core.Converter; +import org.nasdanika.html.Breadcrumbs; +import org.nasdanika.html.HTMLFactory; +import org.nasdanika.html.HTMLFactory.Glyphicon; +import org.nasdanika.html.Table; +import org.nasdanika.html.Table.Row; +import org.nasdanika.html.UIElement.Event; +import org.nasdanika.html.Tabs; +import org.nasdanika.html.Tag; +import org.nasdanika.web.TraceEntry; +import org.nasdanika.web.WebContext; +import org.nasdanika.web.html.HTMLRenderer; + +public class EObjectToHTMLRendererConverter implements Converter { + + @Override + public void close() throws Exception { + // NOP + + } + + protected String label(T source) { + for (EAttribute attr: source.eClass().getEAllAttributes()) { + if (attr.isID()) { + return StringEscapeUtils.escapeHtml4(String.valueOf(source.eGet(attr)))+" ["+source.eClass().getName()+"]"; + } + } + return StringEscapeUtils.escapeHtml4(source.eClass().getName()); + } + + @Override + public HTMLRenderer convert( + final T source, + Class target, + WebContext context) throws Exception { + + return new HTMLRenderer() { + + @Override + public String render(WebContext context, String profile, Map environment) throws Exception { + + if ("label".equals(profile)) { + return label(source); + } + HTMLFactory htmlFactory = context.getHTMLFactory(); + + Breadcrumbs breadcrumbs = htmlFactory.breadcrumbs(); + for (TraceEntry te: context.getPathTrace()) { + breadcrumbs.item(te.getPath(), te.getDisplayName()); + } + breadcrumbs.item(null, label(source)); + + Tag header = htmlFactory.tag("h4", htmlFactory.routeLink("main", context.getObjectPath(source.eClass())+".html", StringEscapeUtils.escapeHtml4(source.eClass().getName()))); + + for (EAttribute attr: source.eClass().getEAllAttributes()) { + if (attr.isID()) { + header.content(" ", StringEscapeUtils.escapeHtml4(String.valueOf(source.eGet(attr)))); + } + } + + List allStructuralFeatures = new ArrayList<>(source.eClass().getEAllStructuralFeatures()); + Collections.sort(allStructuralFeatures, new Comparator() { + + @Override + public int compare(EStructuralFeature o1, EStructuralFeature o2) { + return o1.getName().compareTo(o2.getName()); + } + + }); + + Table scalarsTable = htmlFactory.table().bordered(); + Tabs listsAndContainmentsTabs = htmlFactory.tabs(); + for (EStructuralFeature sf: allStructuralFeatures) { + // TODO - security checks + String sfName = StringUtils.join(StringUtils.splitByCharacterTypeCamelCase(StringUtils.capitalize(sf.getName())), " "); + Object value = source.eGet(sf); + if (sf.isMany()) { + if (!((Collection) source.eGet(sf)).isEmpty() /* || can edit */) { + String fPath = context.getObjectPath(source)+"/"+sf.getName()+".html"; + listsAndContainmentsTabs.ajaxTab(sfName, null, fPath); + } + } else { + if (sf instanceof EReference && ((EReference) sf).isContainment() && (source.eIsSet(sf) /* || can edit */)) { + String valuePath = context.getObjectPath(value); + listsAndContainmentsTabs.ajaxTab(sfName, null, valuePath+".html"); + } else if (source.eIsSet(sf)) { + Row row = scalarsTable.row(); + row.header(sfName); + if (Boolean.TRUE.equals(value)) { + row.cell(htmlFactory.glyphicon(Glyphicon.ok)); + } else if (Boolean.FALSE.equals(value) || value==null) { + row.cell(" "); + } else if (sf instanceof EAttribute) { + row.cell(context.toHTML(value, null, null)); + } else { + row.cell(htmlFactory.routeLink("main", context.getObjectPath(value)+".html", context.toHTML(value, "label", null))); + } + } + } + } + + // TODO - edit/add/delete buttons if there are permissions. + + return htmlFactory.fragment( + htmlFactory.title(label(source)), + breadcrumbs, + header, + source instanceof EModelElement ? htmlFactory.tag("p", NasdanikaCDOUtil.getDocumentation((EModelElement) source)) : "", + scalarsTable, + htmlFactory.button(htmlFactory.glyphicon(Glyphicon.save), " Export to XML").on(Event.click, "window.location.href='"+context.getObjectPath(source)+".xml'"), + "

", + listsAndContainmentsTabs).toString(); + } + }; + } + + +} diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/EPackageToHTMLRendererConverter.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/EPackageToHTMLRendererConverter.java new file mode 100644 index 00000000..2752440b --- /dev/null +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/EPackageToHTMLRendererConverter.java @@ -0,0 +1,101 @@ +package org.nasdanika.cdo.web.html; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.StringEscapeUtils; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EEnum; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.nasdanika.cdo.util.NasdanikaCDOUtil; +import org.nasdanika.core.Converter; +import org.nasdanika.html.Breadcrumbs; +import org.nasdanika.html.HTMLFactory; +import org.nasdanika.html.Table; +import org.nasdanika.html.Table.Row; +import org.nasdanika.html.Tag; +import org.nasdanika.html.UIElement.Color; +import org.nasdanika.web.TraceEntry; +import org.nasdanika.web.WebContext; +import org.nasdanika.web.html.HTMLRenderer; + +public class EPackageToHTMLRendererConverter implements Converter { + + @Override + public void close() throws Exception { + // NOP + + } + + @Override + public HTMLRenderer convert( + final EPackage source, + Class target, + WebContext context) throws Exception { + + return new HTMLRenderer() { + + @Override + public String render(WebContext context, String profile, Map environment) throws Exception { + if ("label".equals(profile)) { + return StringEscapeUtils.escapeHtml4(source.getName()); + } + + HTMLFactory htmlFactory = context.getHTMLFactory(); + Breadcrumbs breadcrumbs = htmlFactory.breadcrumbs(); + for (TraceEntry te: context.getPathTrace()) { + breadcrumbs.item(te.getPath(), te.getDisplayName()); + } + breadcrumbs.item(null, StringEscapeUtils.escapeHtml4(source.getName())); + + Table classifiersTable = htmlFactory.table().bordered(); + + List classifiers = new ArrayList<>(source.getEClassifiers()); + Collections.sort(classifiers, new Comparator() { + + @Override + public int compare(EClassifier o1, EClassifier o2) { + return o1.getName().compareTo(o2.getName()); + } + + }); + + if (!classifiers.isEmpty()) { + Row headerRow = classifiersTable.row().background(Color.GRAY_LIGHTER); + headerRow.header("Name"); + headerRow.header("Type"); + headerRow.header("Description"); + } + + for (EClassifier ec: classifiers) { + Row row = classifiersTable.row(); + Tag classifierLink = htmlFactory.routeLink("main", context.getObjectPath(ec)+".html", StringEscapeUtils.escapeHtml4(ec.getName())); + row.cell(ec instanceof EClass && ((EClass) ec).isAbstract() ? htmlFactory.tag("i", classifierLink) : classifierLink); + if (ec instanceof EClass) { + row.cell(((EClass) ec).isInterface() ? "Interface" : "Class").attribute("align", "center"); + } else if (ec instanceof EEnum) { + row.cell("Enum").attribute("align", "center"); + } else { + row.cell("Data type").attribute("align", "center"); + } + + row.cell(NasdanikaCDOUtil.getSummary(ec)); + } + + return htmlFactory.fragment( + htmlFactory.title("EPackage " + StringEscapeUtils.escapeHtml4(source.getName())), + breadcrumbs, + htmlFactory.tag("h4", "EPackage ", StringEscapeUtils.escapeHtml4(source.getName())), + htmlFactory.tag("p", NasdanikaCDOUtil.getDocumentation(source)), + classifiersTable).toString(); + } + }; + } + + +} diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/EReferenceClosureToHTMLRendererConverter.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/EReferenceClosureToHTMLRendererConverter.java new file mode 100644 index 00000000..c811f929 --- /dev/null +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/EReferenceClosureToHTMLRendererConverter.java @@ -0,0 +1,44 @@ +package org.nasdanika.cdo.web.html; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.StringEscapeUtils; +import org.nasdanika.cdo.EReferenceClosure; +import org.nasdanika.core.Converter; +import org.nasdanika.web.WebContext; +import org.nasdanika.web.html.HTMLRenderer; + +public class EReferenceClosureToHTMLRendererConverter implements Converter { + + @Override + public void close() throws Exception { + // NOP + + } + + @Override + public HTMLRenderer convert(final EReferenceClosure source, Class target, WebContext context) throws Exception { + return new HTMLRenderer() { + + @Override + public String render(WebContext context, String profile, Map environment) throws Exception { + if ("label".equals(profile)) { + return StringEscapeUtils.escapeHtml4(source.getFeature().getName()); + } + if (source.getFeature().isMany()) { + List elements = new ArrayList<>(); + for (Object e: (Iterable) source.getValue()) { + elements.add(context.getHTMLFactory().routeLink("main", context.getObjectPath(e)+".html", context.toHTML(e, "label", null))); + } + return context.getHTMLFactory().ol(elements).toString(); + } + return context.toHTML(source.getValue(), null, null); + } + + }; + } + + +} diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/EStructuralFeatureToHTMLRendererConverter.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/EStructuralFeatureToHTMLRendererConverter.java new file mode 100644 index 00000000..0c61b12c --- /dev/null +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/html/EStructuralFeatureToHTMLRendererConverter.java @@ -0,0 +1,13 @@ +package org.nasdanika.cdo.web.html; + +import org.apache.commons.lang3.StringEscapeUtils; +import org.eclipse.emf.ecore.EStructuralFeature; + +public class EStructuralFeatureToHTMLRendererConverter extends EObjectToHTMLRendererConverter { + + @Override + protected String label(EStructuralFeature source) { + return StringEscapeUtils.escapeHtml4(source.getName()); + } + +} diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/objectpathresolvers/CDOResourcePathResolver.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/objectpathresolvers/CDOResourcePathResolver.java new file mode 100644 index 00000000..d3dc4f27 --- /dev/null +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/objectpathresolvers/CDOResourcePathResolver.java @@ -0,0 +1,23 @@ +package org.nasdanika.cdo.web.objectpathresolvers; + +import org.eclipse.emf.cdo.eresource.CDOResource; +import org.eclipse.emf.cdo.view.CDOView; +import org.nasdanika.core.Context; +import org.nasdanika.web.ObjectPathResolver; + +public class CDOResourcePathResolver implements ObjectPathResolver { + + @Override + public String resolve(CDOResource obj, ObjectPathResolver master, Context context) throws Exception { + CDOView view = obj.cdoView(); + if (view==null) { + return null; + } + String viewPath = master.resolve(view, null, context); + if (viewPath==null) { + return null; + } + return viewPath+"/elements"+obj.getPath(); + } + +} diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/objectpathresolvers/EClassifierPathResolver.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/objectpathresolvers/EClassifierPathResolver.java new file mode 100644 index 00000000..8598b74b --- /dev/null +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/objectpathresolvers/EClassifierPathResolver.java @@ -0,0 +1,17 @@ +package org.nasdanika.cdo.web.objectpathresolvers; + +import java.net.URLEncoder; + +import org.eclipse.emf.ecore.EClassifier; +import org.nasdanika.core.Context; +import org.nasdanika.web.ObjectPathResolver; +import org.nasdanika.web.WebContext; + +public class EClassifierPathResolver implements ObjectPathResolver { + + @Override + public String resolve(EClassifier obj, ObjectPathResolver master, Context context) throws Exception { + return master.resolve(obj.getEPackage(), master, context)+"/"+URLEncoder.encode(obj.getName(), ((WebContext) context).getCharacterEncoding()); + } + +} diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/objectpathresolvers/EObjectPathResolver.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/objectpathresolvers/EObjectPathResolver.java new file mode 100644 index 00000000..ac040818 --- /dev/null +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/objectpathresolvers/EObjectPathResolver.java @@ -0,0 +1,52 @@ +package org.nasdanika.cdo.web.objectpathresolvers; + +import java.net.URLEncoder; +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.resource.Resource; +import org.nasdanika.core.Context; +import org.nasdanika.web.ObjectPathResolver; +import org.nasdanika.web.WebContext; + +/** + * Resolves EObject path relative to its resource using URI fragment. + * @author Pavel + * + */ +public class EObjectPathResolver implements ObjectPathResolver { + + @Override + public String resolve(EObject obj, ObjectPathResolver master, Context context) throws Exception { + Resource res = obj.eResource(); + if (res!=null) { + String resPath = master.resolve(res, master, context); + if (resPath!=null) { + String fragment = res.getURIFragment(obj); + if (fragment != null) { + return resPath+"/"+fragment; + } + } + } + // Resolving by containment + EObject container = obj.eContainer(); + EReference containmentReference = obj.eContainmentFeature(); + if (container!=null && containmentReference!=null) { + String containerPath = master.resolve(container, master, context); + if (containerPath!=null) { + String ret = containerPath+"/"+URLEncoder.encode(containmentReference.getName(), ((WebContext) context).getCharacterEncoding()); + if (containmentReference.isMany()) { + int idx = ((List) container.eGet(containmentReference)).indexOf(obj); + if (idx==-1) { + return null; + } + ret+="/"+idx; + } + return ret; + } + } + return null; + } + +} diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/objectpathresolvers/EPackagePathResolver.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/objectpathresolvers/EPackagePathResolver.java new file mode 100644 index 00000000..930e64e6 --- /dev/null +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/objectpathresolvers/EPackagePathResolver.java @@ -0,0 +1,36 @@ +package org.nasdanika.cdo.web.objectpathresolvers; + +import org.eclipse.emf.cdo.view.CDOView; +import org.eclipse.emf.ecore.EPackage; +import org.nasdanika.cdo.CDOTransactionContext; +import org.nasdanika.cdo.CDOViewContext; +import org.nasdanika.core.Context; +import org.nasdanika.web.ObjectPathResolver; +import org.nasdanika.web.WebContext; + +public class EPackagePathResolver implements ObjectPathResolver { + + @Override + public String resolve(EPackage obj, ObjectPathResolver master, Context context) throws Exception { + CDOView view; + if (context instanceof CDOViewContext) { + view = ((CDOViewContext) context).getView(); + } else if (context instanceof CDOTransactionContext) { + view = ((CDOTransactionContext) context).getTransaction(); + } else { + return null; + } + if (!view.getSession().getPackageRegistry().containsKey(obj.getNsURI())) { + return null; + } + String viewPath = master.resolve(view, null, context); + if (viewPath==null) { + return null; + } + if (context instanceof WebContext) { + return viewPath+"/packages/"+((WebContext) context).getSessionStore().put(obj.getNsURI()); + } + return null; + } + +} diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/objectpathresolvers/EStructuralFeatureClosurePathResolver.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/objectpathresolvers/EStructuralFeatureClosurePathResolver.java new file mode 100644 index 00000000..9e14f4b0 --- /dev/null +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/objectpathresolvers/EStructuralFeatureClosurePathResolver.java @@ -0,0 +1,21 @@ +package org.nasdanika.cdo.web.objectpathresolvers; + +import java.net.URLEncoder; + +import org.nasdanika.cdo.EStructuralFeatureClosure; +import org.nasdanika.core.Context; +import org.nasdanika.web.ObjectPathResolver; +import org.nasdanika.web.WebContext; + +public class EStructuralFeatureClosurePathResolver implements ObjectPathResolver> { + + @Override + public String resolve( + EStructuralFeatureClosure obj, + ObjectPathResolver master, + Context context) throws Exception { + return master.resolve(obj.getObject(), master, context)+"/"+URLEncoder.encode(obj.getFeature().getName(), ((WebContext) context).getCharacterEncoding()); + } + + +} diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/CDOViewHtmlExtensionRoute.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/CDOResourceFolderHtmlExtensionRoute.java similarity index 94% rename from org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/CDOViewHtmlExtensionRoute.java rename to org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/CDOResourceFolderHtmlExtensionRoute.java index fbaa4215..9314caa4 100644 --- a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/CDOViewHtmlExtensionRoute.java +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/CDOResourceFolderHtmlExtensionRoute.java @@ -8,7 +8,7 @@ import org.nasdanika.web.Route; import org.nasdanika.web.WebContext; -public class CDOViewHtmlExtensionRoute implements Route { +public class CDOResourceFolderHtmlExtensionRoute implements Route { @Override public Action execute(final WebContext context) throws Exception { diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/CDOResourceFolderRoute.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/CDOResourceFolderRoute.java index f0346ad1..dc8a5e28 100644 --- a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/CDOResourceFolderRoute.java +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/CDOResourceFolderRoute.java @@ -1,44 +1,43 @@ package org.nasdanika.cdo.web.routes; +import org.apache.commons.lang3.StringEscapeUtils; import org.eclipse.emf.cdo.eresource.CDOResourceFolder; import org.eclipse.emf.cdo.eresource.CDOResourceNode; -import org.json.JSONArray; import org.nasdanika.web.Action; -import org.nasdanika.web.WebContext; import org.nasdanika.web.RequestMethod; import org.nasdanika.web.Route; +import org.nasdanika.web.WebContext; public class CDOResourceFolderRoute implements Route { @Override public Action execute(final WebContext context) throws Exception { final CDOResourceFolder folder = (CDOResourceFolder) context.getTarget(); - if (context.getPath().length==1) { + if (context.getPath().length==1) { if (RequestMethod.GET.equals(context.getMethod())) { - return new Action() { - - @Override - public void close() throws Exception { - // NOP - } - - @Override - public Object execute() throws Exception { - JSONArray ret = new JSONArray(); - for (CDOResourceNode n: folder.getNodes()) { - ret.put(n.getName()); - } - return ret; - } - - }; + if (context.authorize(folder, "read")) { + int dotIdx = context.getPath()[0].lastIndexOf("."); + String extension = dotIdx==-1 ? "json" : context.getPath()[0].substring(dotIdx+1); // json is "default" extension + Action extensionAction = context.getExtensionAction(folder, extension); + return extensionAction==null ? Action.NOT_FOUND : extensionAction; + } + return Action.FORBIDDEN; } + + // TODO - delete, update + return Action.NOT_FOUND; } + + // Router path + context.addPathTraceEntry("#router/main"+context.getObjectPath(folder)+".html", StringEscapeUtils.escapeHtml4(folder.getName())); + for (CDOResourceNode n: folder.getNodes()) { if (context.getPath()[1].equals(n.getName())) { return context.getAction(n, 1); } + + // TODO - create resource in folder. } return Action.NOT_FOUND; } diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/CDOResourceRoute.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/CDOResourceRoute.java index 74861b20..1e04b3cb 100644 --- a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/CDOResourceRoute.java +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/CDOResourceRoute.java @@ -1,51 +1,50 @@ package org.nasdanika.cdo.web.routes; +import org.apache.commons.lang3.StringEscapeUtils; import org.eclipse.emf.cdo.eresource.CDOResource; import org.eclipse.emf.ecore.EObject; -import org.json.JSONArray; -import org.json.JSONObject; import org.nasdanika.web.Action; -import org.nasdanika.web.WebContext; import org.nasdanika.web.RequestMethod; import org.nasdanika.web.Route; +import org.nasdanika.web.WebContext; public class CDOResourceRoute implements Route { @Override public Action execute(final WebContext context) throws Exception { final CDOResource cdoResource = (CDOResource) context.getTarget(); - if (context.getPath().length==1) { + if (context.getPath().length==1) { if (RequestMethod.GET.equals(context.getMethod())) { - return new Action() { - - @Override - public void close() throws Exception { - // NOP - } - - @Override - public Object execute() throws Exception { - JSONArray ret = new JSONArray(); - for (EObject e: cdoResource.getContents()) { - ret.put(context.convert(e, JSONObject.class)); - } - return ret; - } - - }; - } else if (RequestMethod.POST.equals(context.getMethod())) { - // TODO - create EObject and put it to content. + if (context.authorize(cdoResource, "read")) { + int dotIdx = context.getPath()[0].lastIndexOf("."); + String extension = dotIdx==-1 ? "json" : context.getPath()[0].substring(dotIdx+1); // json is "default" extension + Action extensionAction = context.getExtensionAction(cdoResource, extension); + return extensionAction==null ? Action.NOT_FOUND : extensionAction; + } + return Action.FORBIDDEN; } + + // TODO - delete, update + return Action.NOT_FOUND; + } + + // Router path + context.addPathTraceEntry("#router/main"+context.getObjectPath(cdoResource)+".html", StringEscapeUtils.escapeHtml4(cdoResource.getName())); + + String objId = context.getPath()[1]; + int idx = objId.lastIndexOf('.'); + if (idx!=-1) { + objId = objId.substring(0, idx); } - if (Character.isDigit(context.getPath()[1].charAt(0))) { + if (Character.isDigit(objId.charAt(0))) { // Index in content - return context.getAction(cdoResource.getContents().get(Integer.parseInt(context.getPath()[1])), 1); + return context.getAction(cdoResource.getContents().get(Integer.parseInt(objId)), 1); } // CDO ID / uriFragment - EObject eObj = cdoResource.getEObject(context.getPath()[1]); + EObject eObj = cdoResource.getEObject(objId); if (eObj==null) { return Action.NOT_FOUND; } diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/CDOViewJsonExtensionRoute.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/CDOViewJsonExtensionRoute.java index 1b9c3324..2d26b5a5 100644 --- a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/CDOViewJsonExtensionRoute.java +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/CDOViewJsonExtensionRoute.java @@ -3,8 +3,6 @@ import org.eclipse.emf.cdo.eresource.CDOResourceNode; import org.eclipse.emf.cdo.view.CDOView; import org.json.JSONArray; -import org.nasdanika.cdo.web.CDOTransactionHttpContext; -import org.nasdanika.cdo.web.CDOViewHttpContext; import org.nasdanika.web.Action; import org.nasdanika.web.Route; import org.nasdanika.web.WebContext; @@ -13,14 +11,7 @@ public class CDOViewJsonExtensionRoute implements Route { @Override public Action execute(WebContext context) throws Exception { - CDOView view; - if (context instanceof CDOViewHttpContext) { - view = ((CDOViewHttpContext) context).getView(); - } else if (context instanceof CDOTransactionHttpContext) { - view = ((CDOTransactionHttpContext) context).getTransaction(); - } else { - return Action.INTERNAL_SERVER_ERROR; - } + CDOView view = (CDOView) context.getTarget(); final JSONArray viewInfo = new JSONArray(); for (CDOResourceNode e: view.getElements()) { diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/CDOViewRoute.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/CDOViewRoute.java index 59ad7318..a00a5bbc 100644 --- a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/CDOViewRoute.java +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/CDOViewRoute.java @@ -1,9 +1,10 @@ package org.nasdanika.cdo.web.routes; +import org.eclipse.emf.cdo.common.model.CDOPackageInfo; import org.eclipse.emf.cdo.eresource.CDOResourceNode; import org.eclipse.emf.cdo.view.CDOView; -import org.nasdanika.cdo.web.CDOTransactionHttpContext; -import org.nasdanika.cdo.web.CDOViewHttpContext; +import org.eclipse.emf.ecore.EPackage; +import org.nasdanika.cdo.util.NasdanikaCDOUtil; import org.nasdanika.web.Action; import org.nasdanika.web.RequestMethod; import org.nasdanika.web.Route; @@ -13,14 +14,7 @@ public class CDOViewRoute implements Route { @Override public Action execute(WebContext context) throws Exception { - CDOView view; - if (context instanceof CDOViewHttpContext) { - view = ((CDOViewHttpContext) context).getView(); - } else if (context instanceof CDOTransactionHttpContext) { - view = ((CDOTransactionHttpContext) context).getTransaction(); - } else { - return Action.INTERNAL_SERVER_ERROR; - } + CDOView view = (CDOView) context.getTarget(); if (context.getPath().length==1) { if (RequestMethod.GET.equals(context.getMethod())) { @@ -36,18 +30,38 @@ public Action execute(WebContext context) throws Exception { return Action.NOT_FOUND; } - if ("$packageRegistry".equals(context.getPath()[1])) { - Action prAction = context.getAction(view.getSession().getPackageRegistry(), 1); - return prAction==null ? Action.NOT_FOUND : prAction; - } + // Router path + context.addPathTraceEntry("#router/main"+context.getObjectPath(view)+".html", "CDO View"); - for (CDOResourceNode e: view.getElements()) { - if (e.getName().equals(context.getPath()[1])) { - final Action eAction = context.getAction(e, 1); - return eAction==null ? Action.NOT_FOUND : eAction; + if ("packages".equals(context.getPath()[1])) { + String nsURI = (String) context.getSessionStore().get(NasdanikaCDOUtil.stripExtension(context.getPath()[2])); + EPackage ePackage = view.getSession().getPackageRegistry().getEPackage(nsURI); + if (ePackage == null) { + // put packages to store + for (CDOPackageInfo pi: view.getSession().getPackageRegistry().getPackageInfos()) { + context.getSessionStore().put(pi.getEPackage().getNsURI()); + } + nsURI = (String) context.getSessionStore().get(NasdanikaCDOUtil.stripExtension(context.getPath()[2])); + ePackage = view.getSession().getPackageRegistry().getEPackage(nsURI); + if (ePackage == null) { + return Action.NOT_FOUND; + } } + Action prAction = context.getAction(ePackage, 2); + return prAction==null ? Action.NOT_FOUND : prAction; } + if ("elements".equals(context.getPath()[1])) { + for (CDOResourceNode e: view.getElements()) { + if (e.getName().equals(NasdanikaCDOUtil.stripExtension(context.getPath()[2]))) { + final Action eAction = context.getAction(e, 2); + return eAction==null ? Action.NOT_FOUND : eAction; + } + } + + // TODO - create resources. + } + return Action.NOT_FOUND; } diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/EAttributeClosureRoute.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/EAttributeClosureRoute.java new file mode 100644 index 00000000..7d68b096 --- /dev/null +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/EAttributeClosureRoute.java @@ -0,0 +1,67 @@ +package org.nasdanika.cdo.web.routes; + +import java.util.List; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.nasdanika.cdo.EAttributeClosure; +import org.nasdanika.cdo.EReferenceClosure; +import org.nasdanika.cdo.EStructuralFeatureClosure; +import org.nasdanika.web.Action; +import org.nasdanika.web.RequestMethod; +import org.nasdanika.web.Route; +import org.nasdanika.web.WebContext; + +public class EAttributeClosureRoute implements Route { + + @Override + public Action execute(final WebContext context) throws Exception { + final EAttributeClosure eReferenceClosure = (EAttributeClosure) context.getTarget(); + + // Handle many + if (context.getPath().length==1) { + if (RequestMethod.GET.equals(context.getMethod())) { + if (context.authorize(eReferenceClosure, "read")) { + int dotIdx = context.getPath()[0].lastIndexOf("."); + String extension = dotIdx==-1 ? "json" : context.getPath()[0].substring(dotIdx+1); // json is "default" extension + Action extensionAction = context.getExtensionAction(eReferenceClosure, extension); + return extensionAction==null ? Action.NOT_FOUND : extensionAction; + } + return Action.FORBIDDEN; + } + + // TODO - delete, update + + return Action.NOT_FOUND; + } + + // Router path + context.addPathTraceEntry("#router/main"+context.getObjectPath(eReferenceClosure)+".html", context.toHTML(eReferenceClosure, "label", null)); + + if (eReferenceClosure.getFeature().isMany()) { + String index = context.getPath()[1]; + int idx = index.lastIndexOf('.'); + if (idx!=-1) { + index = index.substring(0, idx); + } + Object element = ((List) eReferenceClosure.getValue()).get(Integer.parseInt(index)); + return context.getAction(element, 1); + } + + return Action.NOT_FOUND; + } + + @Override + public boolean canExecute() { + return true; + } + + @Override + public void close() throws Exception { + // NOP + + } + +} diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/EObjectRoute.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/EObjectRoute.java new file mode 100644 index 00000000..c4de7006 --- /dev/null +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/EObjectRoute.java @@ -0,0 +1,71 @@ +package org.nasdanika.cdo.web.routes; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.nasdanika.cdo.EAttributeClosure; +import org.nasdanika.cdo.EReferenceClosure; +import org.nasdanika.web.Action; +import org.nasdanika.web.RequestMethod; +import org.nasdanika.web.Route; +import org.nasdanika.web.WebContext; + +public class EObjectRoute implements Route { + + @Override + public Action execute(final WebContext context) throws Exception { + final EObject eObject = (EObject) context.getTarget(); + if (context.getPath().length==1) { + if (RequestMethod.GET.equals(context.getMethod())) { + if (context.authorize(eObject, "read")) { + int dotIdx = context.getPath()[0].lastIndexOf("."); + String extension = dotIdx==-1 ? "json" : context.getPath()[0].substring(dotIdx+1); // json is "default" extension + Action extensionAction = context.getExtensionAction(eObject, extension); + return extensionAction==null ? Action.NOT_FOUND : extensionAction; + } + return Action.FORBIDDEN; + } + + // TODO - delete, update + + return Action.NOT_FOUND; + } + + // Router path + context.addPathTraceEntry("#router/main"+context.getObjectPath(eObject)+".html", context.toHTML(eObject, "label", null)); + + String featureName = context.getPath()[1]; + int idx = featureName.lastIndexOf('.'); + if (idx!=-1) { + featureName = featureName.substring(0, idx); + } + + // getStructuralFeature doesn't work for some reason + for (EStructuralFeature sf: eObject.eClass().getEAllStructuralFeatures()) { + if (featureName.equals(sf.getName())) { + + } + } + EStructuralFeature feature = eObject.eClass().getEStructuralFeature(featureName); + if (feature instanceof EReference) { + return context.getAction(new EReferenceClosure(eObject, (EReference) feature), 1); + } + if (feature instanceof EAttribute) { + return context.getAction(new EAttributeClosure(eObject, (EAttribute) feature), 1); + } + return Action.NOT_FOUND; + } + + @Override + public boolean canExecute() { + return true; + } + + @Override + public void close() throws Exception { + // NOP + + } + +} diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/EObjectXMIExportRoute.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/EObjectXMIExportRoute.java new file mode 100644 index 00000000..faef58a2 --- /dev/null +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/EObjectXMIExportRoute.java @@ -0,0 +1,81 @@ +package org.nasdanika.cdo.web.routes; + +import java.io.File; +import java.net.URLEncoder; +import java.text.SimpleDateFormat; +import java.util.Date; + +import javax.servlet.http.HttpServletResponse; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; +import org.nasdanika.web.Action; +import org.nasdanika.web.HttpContext; +import org.nasdanika.web.RequestMethod; +import org.nasdanika.web.Route; +import org.nasdanika.web.WebContext; + +public class EObjectXMIExportRoute implements Route { + + @Override + public Action execute(final WebContext context) throws Exception { + + if (RequestMethod.GET.equals(context.getMethod())) { + + return new Action() { + + @Override + public Object execute() throws Exception { + ResourceSet resourceSet = new ResourceSetImpl(); + resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl()); + EObject target = (EObject) context.getTarget(); + StringBuilder nameBuilder = new StringBuilder(target.eClass().getName()); + if (target.eResource()!=null) { + String fragment = target.eResource().getURIFragment(target); + if (fragment!=null) { + nameBuilder.append("-").append(fragment); + } + } + nameBuilder.append("-"); + nameBuilder.append(new SimpleDateFormat("yyyy-MM-dd").format(new Date())); + + String name = URLEncoder.encode(nameBuilder.toString().replace('/', '-'), context.getCharacterEncoding()); + + URI sourceURI = URI.createFileURI(File.createTempFile(name+"-export-", ".xml").getAbsolutePath()); + Resource resource = resourceSet.createResource(sourceURI); + resource.getContents().add(EcoreUtil.copy(target)); + HttpServletResponse response = ((HttpContext) context).getResponse(); + response.setContentType("text/xml"); + response.setHeader("Content-Disposition", "attachment; filename="+name+".xml"); + resource.save(response.getOutputStream(), null); + + return null; + } + + @Override + public void close() throws Exception { + // NOP. + } + + }; + } + + return Action.NOT_FOUND; + } + + @Override + public boolean canExecute() { + return true; + } + + @Override + public void close() throws Exception { + // NOP + } + +} diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/EPackageRoute.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/EPackageRoute.java index c194b0f1..682c7ec5 100644 --- a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/EPackageRoute.java +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/EPackageRoute.java @@ -1,42 +1,40 @@ package org.nasdanika.cdo.web.routes; -import org.eclipse.emf.ecore.EClassifier; +import org.apache.commons.lang3.StringEscapeUtils; import org.eclipse.emf.ecore.EPackage; -import org.json.JSONArray; -import org.json.JSONObject; import org.nasdanika.web.Action; -import org.nasdanika.web.WebContext; +import org.nasdanika.web.RequestMethod; import org.nasdanika.web.Route; +import org.nasdanika.web.WebContext; public class EPackageRoute implements Route { @Override public Action execute(WebContext context) throws Exception { final EPackage ePackage = (EPackage) context.getTarget(); - if (context.getPath().length==1) { - return new Action() { - - @Override - public void close() throws Exception { - // NOP - } + if (context.getPath().length==1) { + if (RequestMethod.GET.equals(context.getMethod())) { + if (context.authorize(ePackage, "read")) { + int dotIdx = context.getPath()[0].lastIndexOf("."); + String extension = dotIdx==-1 ? "json" : context.getPath()[0].substring(dotIdx+1); // json is "default" extension + Action extensionAction = context.getExtensionAction(ePackage, extension); + return extensionAction==null ? Action.NOT_FOUND : extensionAction; + } + return Action.FORBIDDEN; + } + + return Action.NOT_FOUND; + } + + // Router path + context.addPathTraceEntry("#router/main"+context.getObjectPath(ePackage)+".html", StringEscapeUtils.escapeHtml4(ePackage.getName())); - @Override - public Object execute() throws Exception { - JSONObject info = new JSONObject(); - info.put("name", ePackage.getName()); - info.put("uri", ePackage.getNsURI()); - JSONArray classifiers = new JSONArray(); - for (EClassifier c: ePackage.getEClassifiers()) { - classifiers.put(c.getName()); - } - info.put("classifiers", classifiers); - return info; - } - - }; + String className = context.getPath()[1]; + int idx = className.lastIndexOf('.'); + if (idx!=-1) { + className = className.substring(0, idx); } - return context.getAction(ePackage.getEClassifier(context.getPath()[1]), 1); + return context.getAction(ePackage.getEClassifier(className), 1); } @Override diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/EReferenceClosureRoute.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/EReferenceClosureRoute.java new file mode 100644 index 00000000..8a54427a --- /dev/null +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/EReferenceClosureRoute.java @@ -0,0 +1,61 @@ +package org.nasdanika.cdo.web.routes; + +import java.util.List; + +import org.nasdanika.cdo.EReferenceClosure; +import org.nasdanika.web.Action; +import org.nasdanika.web.RequestMethod; +import org.nasdanika.web.Route; +import org.nasdanika.web.WebContext; + +public class EReferenceClosureRoute implements Route { + + @Override + public Action execute(final WebContext context) throws Exception { + final EReferenceClosure eReferenceClosure = (EReferenceClosure) context.getTarget(); + + // Handle many + if (context.getPath().length==1) { + if (RequestMethod.GET.equals(context.getMethod())) { + if (context.authorize(eReferenceClosure, "read")) { + int dotIdx = context.getPath()[0].lastIndexOf("."); + String extension = dotIdx==-1 ? "json" : context.getPath()[0].substring(dotIdx+1); // json is "default" extension + Action extensionAction = context.getExtensionAction(eReferenceClosure, extension); + return extensionAction==null ? Action.NOT_FOUND : extensionAction; + } + return Action.FORBIDDEN; + } + + // TODO - delete, update + + return Action.NOT_FOUND; + } + + // Router path + context.addPathTraceEntry("#router/main"+context.getObjectPath(eReferenceClosure)+".html", context.toHTML(eReferenceClosure, "label", null)); + + if (eReferenceClosure.getFeature().isMany()) { + String index = context.getPath()[1]; + int idx = index.lastIndexOf('.'); + if (idx!=-1) { + index = index.substring(0, idx); + } + Object element = ((List) eReferenceClosure.getValue()).get(Integer.parseInt(index)); + return context.getAction(element, 1); + } + + return Action.NOT_FOUND; + } + + @Override + public boolean canExecute() { + return true; + } + + @Override + public void close() throws Exception { + // NOP + + } + +} diff --git a/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/HtmlExtensionGetRoute.java b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/HtmlExtensionGetRoute.java new file mode 100644 index 00000000..42897bb5 --- /dev/null +++ b/org.nasdanika.cdo/src/org/nasdanika/cdo/web/routes/HtmlExtensionGetRoute.java @@ -0,0 +1,46 @@ +package org.nasdanika.cdo.web.routes; + +import org.nasdanika.web.Action; +import org.nasdanika.web.HttpContext; +import org.nasdanika.web.RequestMethod; +import org.nasdanika.web.Route; +import org.nasdanika.web.WebContext; + +public class HtmlExtensionGetRoute implements Route { + + @Override + public Action execute(final WebContext context) throws Exception { + + if (RequestMethod.GET.equals(context.getMethod())) { + final String html = context.toHTML(context.getTarget(), null, null); + + return new Action() { + + @Override + public Object execute() throws Exception { + ((HttpContext) context).getResponse().setContentType("text/html"); + return html; + } + + @Override + public void close() throws Exception { + // NOP. + } + + }; + } + + return Action.NOT_FOUND; + } + + @Override + public boolean canExecute() { + return true; + } + + @Override + public void close() throws Exception { + // NOP + } + +} diff --git a/org.nasdanika.core.tests/META-INF/MANIFEST.MF b/org.nasdanika.core.tests/META-INF/MANIFEST.MF index 44d60781..e937297b 100644 --- a/org.nasdanika.core.tests/META-INF/MANIFEST.MF +++ b/org.nasdanika.core.tests/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Core Tests Bundle-SymbolicName: org.nasdanika.core.tests -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 0.1.0.qualifier Fragment-Host: org.nasdanika.core Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Require-Bundle: org.junit diff --git a/org.nasdanika.core.tests/pom.xml b/org.nasdanika.core.tests/pom.xml index a3ee279d..5af406e7 100644 --- a/org.nasdanika.core.tests/pom.xml +++ b/org.nasdanika.core.tests/pom.xml @@ -5,7 +5,7 @@ org.nasdanika org.nasdanika.parent - 1.0.0-SNAPSHOT + 0.1.0-SNAPSHOT ../org.nasdanika.parent \ No newline at end of file diff --git a/org.nasdanika.core/META-INF/MANIFEST.MF b/org.nasdanika.core/META-INF/MANIFEST.MF index a2573856..ad779c2f 100644 --- a/org.nasdanika.core/META-INF/MANIFEST.MF +++ b/org.nasdanika.core/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Nasdanika Core Classes and Interfaces Bundle-SymbolicName: org.nasdanika.core;singleton:=true -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 0.1.0.qualifier Bundle-Vendor: Nasdanika LLC Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Require-Bundle: org.eclipse.osgi;bundle-version="3.9.1", diff --git a/org.nasdanika.core/pom.xml b/org.nasdanika.core/pom.xml index 18850061..57663787 100644 --- a/org.nasdanika.core/pom.xml +++ b/org.nasdanika.core/pom.xml @@ -3,7 +3,7 @@ org.nasdanika.parent org.nasdanika - 1.0.0-SNAPSHOT + 0.1.0-SNAPSHOT ../org.nasdanika.parent org.nasdanika.core diff --git a/org.nasdanika.core/src/org/nasdanika/core/NasdanikaException.java b/org.nasdanika.core/src/org/nasdanika/core/NasdanikaException.java new file mode 100644 index 00000000..07e73dff --- /dev/null +++ b/org.nasdanika.core/src/org/nasdanika/core/NasdanikaException.java @@ -0,0 +1,21 @@ +package org.nasdanika.core; + +public class NasdanikaException extends RuntimeException { + + public NasdanikaException(String message) { + super(message); + } + + public NasdanikaException(Throwable cause) { + super(cause); + } + + public NasdanikaException(String message, Throwable cause) { + super(message, cause); + } + + public NasdanikaException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } + +} diff --git a/org.nasdanika.examples.bank.app/META-INF/MANIFEST.MF b/org.nasdanika.examples.bank.app/META-INF/MANIFEST.MF index 49820a58..53a821c3 100644 --- a/org.nasdanika.examples.bank.app/META-INF/MANIFEST.MF +++ b/org.nasdanika.examples.bank.app/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Nasdanika Examples Bank Web Application Bundle-SymbolicName: org.nasdanika.examples.bank.app;singleton:=true -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 0.1.0.qualifier Bundle-Vendor: Nasdanika LLC Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Service-Component: OSGI-INF/*.xml @@ -17,10 +17,10 @@ Require-Bundle: org.eclipse.core.runtime;visibility:=reexport, javax.servlet;bundle-version="3.0.0", org.eclipse.equinox.http.registry;bundle-version="1.1.300", org.eclipse.osgi, - org.nasdanika.examples.bank;bundle-version="1.0.0", + org.nasdanika.examples.bank;bundle-version="0.1.0", org.eclipse.jetty.websocket;bundle-version="8.1.14", org.eclipse.jetty.util;bundle-version="8.1.14", org.nasdanika.cdo;bundle-version="0.1.0", org.nasdanika.cdo.h2;bundle-version="0.1.0", - org.nasdanika.web;bundle-version="1.0.0", + org.nasdanika.web;bundle-version="0.1.0", org.json;bundle-version="1.0.0" diff --git a/org.nasdanika.examples.bank.app/pom.xml b/org.nasdanika.examples.bank.app/pom.xml index ff7e77ef..47cec047 100644 --- a/org.nasdanika.examples.bank.app/pom.xml +++ b/org.nasdanika.examples.bank.app/pom.xml @@ -5,7 +5,7 @@ org.nasdanika org.nasdanika.parent - 1.0.0-SNAPSHOT + 0.1.0-SNAPSHOT ../org.nasdanika.parent \ No newline at end of file diff --git a/org.nasdanika.examples.bank.app/src/org/nasdanika/examples/bank/app/AppRoute.java b/org.nasdanika.examples.bank.app/src/org/nasdanika/examples/bank/app/AppRoute.java index 63a17c2c..e5c7991c 100644 --- a/org.nasdanika.examples.bank.app/src/org/nasdanika/examples/bank/app/AppRoute.java +++ b/org.nasdanika.examples.bank.app/src/org/nasdanika/examples/bank/app/AppRoute.java @@ -6,6 +6,7 @@ import org.nasdanika.html.Accordion; import org.nasdanika.html.ApplicationPanel; +import org.nasdanika.html.Breadcrumbs; import org.nasdanika.html.Button; import org.nasdanika.html.Form; import org.nasdanika.html.FormGroup.Status; @@ -58,15 +59,19 @@ public Action execute(WebContext context) throws Exception { .item(htmlFactory.link("#", "Wire")) .item(htmlFactory.link("#", "Payment Gateway")); + Breadcrumbs breadcrumbs = htmlFactory.breadcrumbs() + .item("#", "Home") + .item("#", "My page") + .item(null, "Details"); - appPanel.navigation(navBar); + appPanel.navigation(navBar, breadcrumbs); appPanel.contentPanel( htmlFactory.linkGroup() .item("Item 1", "#", Style.DEFAULT, true) .item("Item 2", "#", Style.DEFAULT, false) .item("Item 3", "#", Style.SUCCESS, false)) - .width(DeviceSize.LARGE, 2); + .width(DeviceSize.LARGE, 2).id("side-panel"); Accordion accordion = htmlFactory.accordion() .item("Item 1", "Item 1 body", Style.DEFAULT) @@ -89,6 +94,8 @@ public Action execute(WebContext context) throws Exception { body.content(htmlFactory.tag("div", "").style("min-height", "200px")); + body.content(htmlFactory.inject("#side-panel", "Hello!")); + Button simpleButton = htmlFactory.button("Simple button").on(Event.click, "alert('Hello > & ');"); body.content(simpleButton, " "); @@ -186,7 +193,7 @@ public Action execute(WebContext context) throws Exception { body.content(htmlFactory.panel(Style.PRIMARY, "Panel header", "Panel with header", null) ); body.content(htmlFactory.panel(Style.WARNING, "Warning", "Something is fishy", "Proceed with caution!")); - Button popoverButton = htmlFactory.button("Click me for information!").id("info_button"); + Button popoverButton = htmlFactory.button("Click me for information!").id("info_button").remoteContent("/test.html"); htmlFactory.popover(popoverButton, Placement.RIGHT, null, "Some useful information"); body.content(popoverButton); body.content(htmlFactory.tag("script", "$('#info_button').popover();")); @@ -214,7 +221,7 @@ public Action execute(WebContext context) throws Exception { Row transaction3 = transactionTable.row().style(Style.WARNING); // below low balance threshold transaction3.cell("05/02/2014"); - transaction3.cell("Check 1234"); + transaction3.cell("...").remoteContent("/test.html"); transaction3.cell("-100.00").attribute("align", "right"); transaction3.cell("50.00").attribute("align", "right"); @@ -270,7 +277,7 @@ public void close() throws Exception { "My Application", null, null, - body); + appPanel); // TODO Auto-generated method stub return new Action() { diff --git a/org.nasdanika.examples.bank.app/src/org/nasdanika/examples/bank/app/HomeRoute.java b/org.nasdanika.examples.bank.app/src/org/nasdanika/examples/bank/app/HomeRoute.java index a9c5ab30..57f03b92 100644 --- a/org.nasdanika.examples.bank.app/src/org/nasdanika/examples/bank/app/HomeRoute.java +++ b/org.nasdanika.examples.bank.app/src/org/nasdanika/examples/bank/app/HomeRoute.java @@ -29,7 +29,7 @@ public Action execute(WebContext context) throws Exception { final AutoCloseable app = htmlFactory.routerApplication( "My Application", - "main/ccview.html", + "main/router/ccview.html", null, htmlFactory.div("").id("main")); diff --git a/org.nasdanika.examples.bank/META-INF/MANIFEST.MF b/org.nasdanika.examples.bank/META-INF/MANIFEST.MF index e61d6e0e..4df5652d 100644 --- a/org.nasdanika.examples.bank/META-INF/MANIFEST.MF +++ b/org.nasdanika.examples.bank/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.nasdanika.examples.bank;singleton:=true -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 0.1.0.qualifier Bundle-ClassPath: . Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -14,5 +14,5 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.emf.ecore;visibility:=reexport, org.eclipse.emf.cdo;visibility:=reexport, org.eclipse.osgi.services;bundle-version="3.3.100", - org.nasdanika.cdo;bundle-version="1.0.0" + org.nasdanika.cdo;bundle-version="0.1.0" Bundle-ActivationPolicy: lazy diff --git a/org.nasdanika.examples.bank/model/bank.ecore b/org.nasdanika.examples.bank/model/bank.ecore index 831f804a..efa22f3c 100644 --- a/org.nasdanika.examples.bank/model/bank.ecore +++ b/org.nasdanika.examples.bank/model/bank.ecore @@ -1,7 +1,13 @@ + +
+ + +
+ diff --git a/org.nasdanika.examples.bank/model/bank.genmodel b/org.nasdanika.examples.bank/model/bank.genmodel index 4327c69a..9f62631e 100644 --- a/org.nasdanika.examples.bank/model/bank.genmodel +++ b/org.nasdanika.examples.bank/model/bank.genmodel @@ -3,7 +3,7 @@ xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/org.nasdanika.examples.bank/src" modelPluginID="org.nasdanika.examples.bank" modelName="Bank" rootExtendsInterface="org.eclipse.emf.cdo.CDOObject" rootExtendsClass="org.eclipse.emf.internal.cdo.CDOObjectImpl" reflectiveDelegation="true" importerID="org.eclipse.emf.importer.cdo" featureDelegation="Reflective" - complianceLevel="7.0" copyrightFields="false"> + complianceLevel="7.0" suppressGenModelAnnotations="false" copyrightFields="false"> bank.ecore CDO=org.eclipse.emf.cdo org.nasdanika org.nasdanika.parent - 1.0.0-SNAPSHOT + 0.1.0-SNAPSHOT ../org.nasdanika.parent \ No newline at end of file diff --git a/org.nasdanika.examples.bank/src/org/nasdanika/examples/bank/BankPackage.java b/org.nasdanika.examples.bank/src/org/nasdanika/examples/bank/BankPackage.java index d93425bc..57ffa6b2 100644 --- a/org.nasdanika.examples.bank/src/org/nasdanika/examples/bank/BankPackage.java +++ b/org.nasdanika.examples.bank/src/org/nasdanika/examples/bank/BankPackage.java @@ -19,6 +19,11 @@ *
  • and each data type
  • * * + * + * This package contains bank classes. + * + * One more line. + * * @see org.nasdanika.examples.bank.BankFactory * @model kind="package" * @generated diff --git a/org.nasdanika.examples.bank/src/org/nasdanika/examples/bank/SystemOfRecords.java b/org.nasdanika.examples.bank/src/org/nasdanika/examples/bank/SystemOfRecords.java index b0e9935d..a5936c7e 100644 --- a/org.nasdanika.examples.bank/src/org/nasdanika/examples/bank/SystemOfRecords.java +++ b/org.nasdanika.examples.bank/src/org/nasdanika/examples/bank/SystemOfRecords.java @@ -11,6 +11,10 @@ * A representation of the model object 'System Of Records'. * * + * + * System of records is the root of the model. + * + * *

    * The following features are supported: *

      diff --git a/org.nasdanika.examples.bank/src/org/nasdanika/examples/bank/impl/BankPackageImpl.java b/org.nasdanika.examples.bank/src/org/nasdanika/examples/bank/impl/BankPackageImpl.java index f796bb45..171b3ef5 100644 --- a/org.nasdanika.examples.bank/src/org/nasdanika/examples/bank/impl/BankPackageImpl.java +++ b/org.nasdanika.examples.bank/src/org/nasdanika/examples/bank/impl/BankPackageImpl.java @@ -885,6 +885,32 @@ public void initializePackageContents() { // Create resource createResource(eNS_URI); + + // Create annotations + // http://www.eclipse.org/emf/2002/GenModel + createGenModelAnnotations(); + } + + /** + * Initializes the annotations for http://www.eclipse.org/emf/2002/GenModel. + * + * + * @generated + */ + protected void createGenModelAnnotations() { + String source = "http://www.eclipse.org/emf/2002/GenModel"; + addAnnotation + (this, + source, + new String[] { + "documentation", "This package contains bank classes.\r\n\r\nOne more line." + }); + addAnnotation + (systemOfRecordsEClass, + source, + new String[] { + "documentation", "System of records is the root of the model." + }); } } //BankPackageImpl diff --git a/org.nasdanika.examples.bank/src/org/nasdanika/examples/bank/impl/CreditCardImpl.java b/org.nasdanika.examples.bank/src/org/nasdanika/examples/bank/impl/CreditCardImpl.java index 88f04387..af34d55f 100644 --- a/org.nasdanika.examples.bank/src/org/nasdanika/examples/bank/impl/CreditCardImpl.java +++ b/org.nasdanika.examples.bank/src/org/nasdanika/examples/bank/impl/CreditCardImpl.java @@ -7,6 +7,8 @@ import org.eclipse.emf.ecore.EClass; import org.nasdanika.examples.bank.BankPackage; import org.nasdanika.examples.bank.CreditCard; +import org.nasdanika.web.ActionMethod; +import org.nasdanika.web.HttpContext; /** * @@ -77,5 +79,12 @@ public int getGracePeriod() { public void setGracePeriod(int newGracePeriod) { eSet(BankPackage.Literals.CREDIT_CARD__GRACE_PERIOD, newGracePeriod); } + + + @ActionMethod(pattern=".+\\.html") + public String home(HttpContext context) { + return "he"; + } + } //CreditCardImpl diff --git a/org.nasdanika.examples.bank/src/org/nasdanika/examples/bank/impl/SystemOfRecordsImpl.java b/org.nasdanika.examples.bank/src/org/nasdanika/examples/bank/impl/SystemOfRecordsImpl.java index 51427837..73e8723f 100644 --- a/org.nasdanika.examples.bank/src/org/nasdanika/examples/bank/impl/SystemOfRecordsImpl.java +++ b/org.nasdanika.examples.bank/src/org/nasdanika/examples/bank/impl/SystemOfRecordsImpl.java @@ -5,10 +5,13 @@ import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.internal.cdo.CDOObjectImpl; +import org.nasdanika.core.CommandMethod; import org.nasdanika.examples.bank.BankPackage; import org.nasdanika.examples.bank.Customer; import org.nasdanika.examples.bank.Product; import org.nasdanika.examples.bank.SystemOfRecords; +import org.nasdanika.web.ActionMethod; +import org.nasdanika.web.HttpContext; /** * diff --git a/org.nasdanika.examples.feature/pom.xml b/org.nasdanika.examples.feature/pom.xml index 6c813bef..8bdf64b0 100644 --- a/org.nasdanika.examples.feature/pom.xml +++ b/org.nasdanika.examples.feature/pom.xml @@ -5,7 +5,7 @@ org.nasdanika org.nasdanika.parent - 1.0.0-SNAPSHOT + 0.1.0-SNAPSHOT ../org.nasdanika.parent \ No newline at end of file diff --git a/org.nasdanika.feature/feature.xml b/org.nasdanika.feature/feature.xml index 184d3b99..40a0c6d4 100644 --- a/org.nasdanika.feature/feature.xml +++ b/org.nasdanika.feature/feature.xml @@ -2,18 +2,87 @@ + version="0.1.0.qualifier"> - - [Enter Feature Description here.] + + Nasdanika foundation server components. - - [Enter Copyright Description here.] + + Property of Nasdanika LLC - - [Enter License Description here.] + + Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: +i) changes to the Program, and +ii) additions to the Program; +where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this Agreement. + +"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. +b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. +c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. +d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and +b) its license agreement: +i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; +ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; +iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and +iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and +b) a copy of this Agreement must be included with each copy of the Program. +Contributors may not remove or alter any copyright notices contained within the Program. + +Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. + + + + diff --git a/org.nasdanika.feature/pom.xml b/org.nasdanika.feature/pom.xml index 2f38aead..d0f43935 100644 --- a/org.nasdanika.feature/pom.xml +++ b/org.nasdanika.feature/pom.xml @@ -5,7 +5,7 @@ org.nasdanika org.nasdanika.parent - 1.0.0-SNAPSHOT + 0.1.0-SNAPSHOT ../org.nasdanika.parent \ No newline at end of file diff --git a/org.nasdanika.html.feature/.classpath b/org.nasdanika.html.feature/.classpath new file mode 100644 index 00000000..0a1daddd --- /dev/null +++ b/org.nasdanika.html.feature/.classpath @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/org.nasdanika.html.feature/.gitignore b/org.nasdanika.html.feature/.gitignore new file mode 100644 index 00000000..ea8c4bf7 --- /dev/null +++ b/org.nasdanika.html.feature/.gitignore @@ -0,0 +1 @@ +/target diff --git a/org.nasdanika.html.feature/.project b/org.nasdanika.html.feature/.project new file mode 100644 index 00000000..c31a83c7 --- /dev/null +++ b/org.nasdanika.html.feature/.project @@ -0,0 +1,29 @@ + + + org.nasdanika.html.feature + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.FeatureBuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.pde.FeatureNature + + diff --git a/org.nasdanika.html.feature/.settings/org.eclipse.jdt.core.prefs b/org.nasdanika.html.feature/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..abec6ca3 --- /dev/null +++ b/org.nasdanika.html.feature/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/org.nasdanika.html.feature/.settings/org.eclipse.m2e.core.prefs b/org.nasdanika.html.feature/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 00000000..f897a7f1 --- /dev/null +++ b/org.nasdanika.html.feature/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/org.nasdanika.parent/pom.xml b/org.nasdanika.parent/pom.xml index 43bd06e8..00c3da91 100644 --- a/org.nasdanika.parent/pom.xml +++ b/org.nasdanika.parent/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.nasdanika org.nasdanika.parent - 1.0.0-SNAPSHOT + 0.1.0-SNAPSHOT pom @@ -55,7 +55,7 @@ target-platform-configuration ${tycho-version} - + consider @@ -88,6 +88,7 @@ + ../org.nasdanika.thirdparty ../org.nasdanika.html ../org.nasdanika.core ../org.nasdanika.core.tests @@ -102,5 +103,6 @@ ../org.nasdanika.examples.feature ../org.nasdankia.server.jetty.feature ../org.nasdanika.server.third_party.feature + ../org.nasdanika.html.feature diff --git a/org.nasdanika.repository/category.xml b/org.nasdanika.repository/category.xml index 9a67b227..4c92ae8f 100644 --- a/org.nasdanika.repository/category.xml +++ b/org.nasdanika.repository/category.xml @@ -12,6 +12,9 @@ + + + Nasdanika features. diff --git a/org.nasdanika.repository/pom.xml b/org.nasdanika.repository/pom.xml index 5f7e0cbb..a5f9eaf1 100644 --- a/org.nasdanika.repository/pom.xml +++ b/org.nasdanika.repository/pom.xml @@ -7,7 +7,7 @@ org.nasdanika org.nasdanika.parent - 1.0.0-SNAPSHOT + 0.1.0-SNAPSHOT ../org.nasdanika.parent diff --git a/org.nasdanika.server.third_party.feature/feature.xml b/org.nasdanika.server.third_party.feature/feature.xml index b878d987..a35024f9 100644 --- a/org.nasdanika.server.third_party.feature/feature.xml +++ b/org.nasdanika.server.third_party.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/org.nasdanika.server.third_party.feature/pom.xml b/org.nasdanika.server.third_party.feature/pom.xml index 0de71873..2ca40ca4 100644 --- a/org.nasdanika.server.third_party.feature/pom.xml +++ b/org.nasdanika.server.third_party.feature/pom.xml @@ -5,7 +5,7 @@ org.nasdanika org.nasdanika.parent - 1.0.0-SNAPSHOT + 0.1.0-SNAPSHOT ../org.nasdanika.parent \ No newline at end of file diff --git a/org.nasdanika.thirdparty/.gitignore b/org.nasdanika.thirdparty/.gitignore new file mode 100644 index 00000000..ea8c4bf7 --- /dev/null +++ b/org.nasdanika.thirdparty/.gitignore @@ -0,0 +1 @@ +/target diff --git a/org.nasdanika.thirdparty/pom.xml b/org.nasdanika.thirdparty/pom.xml new file mode 100644 index 00000000..ab7ad377 --- /dev/null +++ b/org.nasdanika.thirdparty/pom.xml @@ -0,0 +1,103 @@ + + + 4.0.0 + + + org.nasdanika + org.nasdanika.parent + 1.0.0-SNAPSHOT + ../org.nasdanika.parent + + + org.nasdanika.thirdparty + bundle + + + + + org.apache.commons + commons-lang3 + 3.3.2 + + + + + + + + org.apache.felix + maven-bundle-plugin + true + + + + commons-lang3 + + <_exportcontents> + org.apache.commons.lang3.*;version="3.3.2" + + {maven-dependencies} + true + jars + <_failok>true + <_nouses>true + + + + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + bundle + org.sonatype.tycho.m2e.wrapperBundle + + + + + + org.apache.felix + maven-bundle-plugin + 2.1.0 + + bundle + + + + + org.sonatype.tycho.m2e.wrapperBundle + + + + + + org.apache.felix + maven-bundle-plugin + 2.1.0 + + manifest + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/org.nasdanika.transaction/META-INF/MANIFEST.MF b/org.nasdanika.transaction/META-INF/MANIFEST.MF index ab6fee8a..43312903 100644 --- a/org.nasdanika.transaction/META-INF/MANIFEST.MF +++ b/org.nasdanika.transaction/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Nasdanika Transaction Support Bundle-SymbolicName: org.nasdanika.transaction -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 0.1.0.qualifier Bundle-Vendor: Nasdanika LLC Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Service-Component: OSGI-INF/*.xml diff --git a/org.nasdanika.transaction/pom.xml b/org.nasdanika.transaction/pom.xml index 5de18177..6c8ba12d 100644 --- a/org.nasdanika.transaction/pom.xml +++ b/org.nasdanika.transaction/pom.xml @@ -5,7 +5,7 @@ org.nasdanika org.nasdanika.parent - 1.0.0-SNAPSHOT + 0.1.0-SNAPSHOT ../org.nasdanika.parent \ No newline at end of file diff --git a/org.nasdanika.web/META-INF/MANIFEST.MF b/org.nasdanika.web/META-INF/MANIFEST.MF index 864f4c9e..650c35de 100644 --- a/org.nasdanika.web/META-INF/MANIFEST.MF +++ b/org.nasdanika.web/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Nasdanika Web Commands Framework Bundle-SymbolicName: org.nasdanika.web;singleton:=true -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 0.1.0.qualifier Bundle-Vendor: Nasdanika LLC Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Require-Bundle: javax.servlet;bundle-version="3.0.0", @@ -10,8 +10,9 @@ Require-Bundle: javax.servlet;bundle-version="3.0.0", org.eclipse.jetty.websocket;bundle-version="8.1.14", org.eclipse.jetty.util;bundle-version="8.1.14", org.eclipse.osgi, - org.nasdanika.core;bundle-version="1.0.0";visibility:=reexport, - org.nasdanika.html;bundle-version="1.0.0";visibility:=reexport + org.nasdanika.core;bundle-version="0.1.0";visibility:=reexport, + org.nasdanika.html;bundle-version="1.2.0";visibility:=reexport, + org.nasdanika.thirdparty;bundle-version="1.0.0" Export-Package: org.nasdanika.web, org.nasdanika.web.html Bundle-ActivationPolicy: lazy diff --git a/org.nasdanika.web/plugin.xml b/org.nasdanika.web/plugin.xml index 23c926d7..9acc7f58 100644 --- a/org.nasdanika.web/plugin.xml +++ b/org.nasdanika.web/plugin.xml @@ -3,6 +3,7 @@ + org.nasdanika org.nasdanika.parent - 1.0.0-SNAPSHOT + 0.1.0-SNAPSHOT ../org.nasdanika.parent \ No newline at end of file diff --git a/org.nasdanika.web/schema/object_path_resolver.exsd b/org.nasdanika.web/schema/object_path_resolver.exsd new file mode 100644 index 00000000..03d81594 --- /dev/null +++ b/org.nasdanika.web/schema/object_path_resolver.exsd @@ -0,0 +1,112 @@ + + + + + + + + + Allows to contribute object path resolvers. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Object type for this resolver. + + + + + + + + + + + + + + + [Enter the first release in which this extension point appears.] + + + + + + + + + [Enter extension point usage example here.] + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + diff --git a/org.nasdanika.web/src/org/nasdanika/web/CompositeObjectPathResolver.java b/org.nasdanika.web/src/org/nasdanika/web/CompositeObjectPathResolver.java new file mode 100644 index 00000000..17a7dac3 --- /dev/null +++ b/org.nasdanika.web/src/org/nasdanika/web/CompositeObjectPathResolver.java @@ -0,0 +1,62 @@ +package org.nasdanika.web; + +import java.util.ArrayList; +import java.util.List; + +import org.nasdanika.core.Context; + +public class CompositeObjectPathResolver implements ObjectPathResolver, Cloneable { + + private List> resolvers = new ArrayList<>(); + + private class ResolverEntry { + Class clazz; + ObjectPathResolver resolver; + + ResolverEntry(Class clazz, ObjectPathResolver resolver) { + super(); + this.clazz = clazz; + this.resolver = resolver; + } + } + + public void addResolver(Class clazz, ObjectPathResolver resolver) { + resolvers.add(new ResolverEntry<>(clazz, resolver)); + } + + @SuppressWarnings("unchecked") + @Override + public String resolve(Object obj, ObjectPathResolver master, Context context) throws Exception { + ResolverEntry candidate = null; + for (ResolverEntry r: resolvers) { + if (r.clazz==null || r.clazz.isInstance(obj)) { + if (candidate==null + || candidate.clazz==null + || candidate.clazz.isAssignableFrom(r.clazz)) { + candidate = (ResolverEntry) r; + } + } + } + if (candidate!=null) { + String ret = candidate.resolver.resolve(obj, this, context); + if (ret!=null) { + return ret; + } + } + if (master!=null) { + String ret = master.resolve(obj, null, context); + if (ret!=null) { + return ret; + } + } + return context instanceof WebContext ? ((WebContext) context).getRootObjectsPaths().get(obj) : null; + } + + @Override + public CompositeObjectPathResolver clone() throws CloneNotSupportedException { + CompositeObjectPathResolver ret = (CompositeObjectPathResolver) super.clone(); + ret.resolvers = new ArrayList<>(ret.resolvers); // Deep copy of resolvers list. + return ret; + } + +} diff --git a/org.nasdanika.web/src/org/nasdanika/web/ContextImpl.java b/org.nasdanika.web/src/org/nasdanika/web/ContextImpl.java index 6c752aa8..ad3a8919 100644 --- a/org.nasdanika.web/src/org/nasdanika/web/ContextImpl.java +++ b/org.nasdanika.web/src/org/nasdanika/web/ContextImpl.java @@ -1,8 +1,12 @@ package org.nasdanika.web; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import org.apache.commons.lang3.StringEscapeUtils; import org.nasdanika.core.AuthorizationProvider; import org.nasdanika.core.Converter; import org.nasdanika.html.HTMLFactory; @@ -11,23 +15,30 @@ public abstract class ContextImpl implements WebContext { private ExtensionManager extensionManager; + private Map rootObjectsPaths = new ConcurrentHashMap<>(); public ExtensionManager getExtensionManager() { return extensionManager; } + public Map getRootObjectsPaths() { + return rootObjectsPaths; + } + private AuthorizationProvider securityManager; private Converter converter; private String[] path; private Object target; private RouteRegistry routeRegistry; private Object principal; + private CompositeObjectPathResolver objectPathResolver; public ContextImpl( Object principal, String[] path, Object target, - ExtensionManager extensionManager) throws Exception { + final ExtensionManager extensionManager, + List pathTrace) throws Exception { this.extensionManager = extensionManager; this.securityManager = extensionManager.getAuthorizationProvider(); @@ -36,6 +47,12 @@ public ContextImpl( this.target = target; this.routeRegistry = extensionManager.getRouteRegistry(); this.principal = principal; + + objectPathResolver = extensionManager.getObjectPathResolver(); + + if (pathTrace!=null) { + this.pathTrace.addAll(pathTrace); + } } @Override @@ -68,10 +85,23 @@ public Action getAction(Object target, int pathOffset) throws Exception { String[] newPath = Arrays.copyOfRange(oldPath, pathOffset, oldPath.length); WebContext subContext = createSubContext(newPath, target); for (Route r: routeRegistry.matchObjectRoutes(getMethod(), target, newPath)) { - Action ret = r.execute(subContext); - if (ret!=null) { - return ret; + final Object ret = r.execute(subContext); + if (ret instanceof Action) { + return (Action) ret; } + + return new Action() { + + @Override + public void close() throws Exception { + // NOP + } + + @Override + public Object execute() throws Exception { + return ret; + } + }; } return null; } @@ -98,7 +128,7 @@ public Object getTarget() { public String toHTML(Object obj, String profile, Map environment) throws Exception { HTMLRenderer renderer = convert(obj, HTMLRenderer.class); if (renderer == null) { - return String.valueOf(obj); + return "
      "+StringEscapeUtils.escapeHtml4(String.valueOf(obj))+"
      "; } return renderer.render(this, profile, environment); } @@ -108,11 +138,31 @@ public HTMLFactory getHTMLFactory() { return extensionManager.getHTMLFactory(); } - /** - * Default implementation returns null. - */ @Override - public String getObjectURL(Object object) { - return null; + public String getObjectPath(Object object) throws Exception { + return objectPathResolver.resolve(object, null, this); + } + + @Override + public void addPathTraceEntry(final String path, final String displayName) { + pathTrace.add(new TraceEntry() { + + @Override + public String getPath() { + return path; + } + + @Override + public String getDisplayName() { + return displayName; + } + }); + } + + private List pathTrace = new ArrayList<>(); + + @Override + public List getPathTrace() { + return pathTrace; } } diff --git a/org.nasdanika.web/src/org/nasdanika/web/ExtensionManager.java b/org.nasdanika.web/src/org/nasdanika/web/ExtensionManager.java index 05c80803..7500fb8b 100644 --- a/org.nasdanika.web/src/org/nasdanika/web/ExtensionManager.java +++ b/org.nasdanika.web/src/org/nasdanika/web/ExtensionManager.java @@ -43,6 +43,7 @@ public class ExtensionManager implements AutoCloseable { private BundleContext bundleContext; private HTMLFactory htmlFactory; + @SuppressWarnings("unchecked") public ExtensionManager(BundleContext context, String routeServiceFilter, String htmlFactoryName) throws Exception { // TODO - converter profiles map: class name -> profile. if (context==null) { @@ -58,8 +59,7 @@ public ExtensionManager(BundleContext context, String routeServiceFilter, String } routeServiceTracker.open(); - IConfigurationElement[] actionConfigurationElements = Platform.getExtensionRegistry().getConfigurationElementsFor(HTML_FACTORY_ID); - for (IConfigurationElement ce: actionConfigurationElements) { + for (IConfigurationElement ce: Platform.getExtensionRegistry().getConfigurationElementsFor(HTML_FACTORY_ID)) { if ("default_html_factory".equals(ce.getName())) { if (htmlFactoryName==null || htmlFactoryName.equals("default")) { DefaultHTMLFactory defaultHTMLFactory = new DefaultHTMLFactory(); @@ -79,11 +79,23 @@ public ExtensionManager(BundleContext context, String routeServiceFilter, String break; } } - } + } + + objectPathResolver = new CompositeObjectPathResolver(); + for (IConfigurationElement ce: Platform.getExtensionRegistry().getConfigurationElementsFor(OBJECT_PATH_RESOLVER_ID)) { + if ("resolver".equals(ce.getName())) { + IContributor contributor = ce.getContributor(); + Bundle bundle = Platform.getBundle(contributor.getName()); + objectPathResolver.addResolver( + (Class) bundle.loadClass(ce.getAttribute("target").trim()), + (ObjectPathResolver) ce.createExecutableExtension("class")); + } + } } public static final String HTML_FACTORY_ID = "org.nasdanika.web.html_factory"; public static final String ROUTE_ID = "org.nasdanika.web.route"; + public static final String OBJECT_PATH_RESOLVER_ID = "org.nasdanika.web.object_path_resolver"; public static final String CONVERT_ID = "org.nasdanika.core.convert"; private static final String SECURITY_ID = "org.nasdanika.core.security"; @@ -144,19 +156,29 @@ public int compareTo(ConverterEntry o) { if (source.isAssignableFrom(o.source) && !o.source.isAssignableFrom(source)) { return 1; // o is more specific. } + + if (o.source.isAssignableFrom(source) && !source.isAssignableFrom(o.source)) { + return -1; // this is more specific. + } + if (o.priority != priority) { return o.priority - priority; } + if (target.isAssignableFrom(o.target) && !o.target.isAssignableFrom(target)) { return -1; // o is more specific } + + if (o.target.isAssignableFrom(target) && !target.isAssignableFrom(o.target)) { + return 1; // this is more specific + } + return 0; } } final List ceList = new ArrayList<>(); - IConfigurationElement[] actionConfigurationElements = Platform.getExtensionRegistry().getConfigurationElementsFor(CONVERT_ID); - for (IConfigurationElement ce: actionConfigurationElements) { + for (IConfigurationElement ce: Platform.getExtensionRegistry().getConfigurationElementsFor(CONVERT_ID)) { if ("converter".equals(ce.getName())) { @SuppressWarnings("unchecked") ConverterEntry cEntry = new ConverterEntry((Converter) ce.createExecutableExtension("class")); @@ -233,8 +255,7 @@ public int compareTo(AuthorizationProviderEntry o) { } final List smeList = new ArrayList<>(); - IConfigurationElement[] actionConfigurationElements = Platform.getExtensionRegistry().getConfigurationElementsFor(SECURITY_ID); - for (IConfigurationElement ce: actionConfigurationElements) { + for (IConfigurationElement ce: Platform.getExtensionRegistry().getConfigurationElementsFor(SECURITY_ID)) { if ("security_manager".equals(ce.getName())) { AuthorizationProviderEntry sme = new AuthorizationProviderEntry((AuthorizationProvider) ce.createExecutableExtension("class")); @@ -584,8 +605,7 @@ protected synchronized List getRoutes(RouteType routeType, RequestMe routeMap.put(rt, new HashMap>()); } - IConfigurationElement[] actionConfigurationElements = Platform.getExtensionRegistry().getConfigurationElementsFor(ExtensionManager.ROUTE_ID); - for (IConfigurationElement ce: actionConfigurationElements) { + for (IConfigurationElement ce: Platform.getExtensionRegistry().getConfigurationElementsFor(ExtensionManager.ROUTE_ID)) { if ("object_route".equals(ce.getName())) { Route route = (Route) ce.createExecutableExtension("class"); injectProperties(ce, route); @@ -885,4 +905,10 @@ public HTMLFactory getHTMLFactory() { return htmlFactory; } + private CompositeObjectPathResolver objectPathResolver; + + public CompositeObjectPathResolver getObjectPathResolver() { + return objectPathResolver; + } + } diff --git a/org.nasdanika.web/src/org/nasdanika/web/HttpContextImpl.java b/org.nasdanika.web/src/org/nasdanika/web/HttpContextImpl.java index 4258ae96..38331cd0 100644 --- a/org.nasdanika.web/src/org/nasdanika/web/HttpContextImpl.java +++ b/org.nasdanika.web/src/org/nasdanika/web/HttpContextImpl.java @@ -1,10 +1,24 @@ package org.nasdanika.web; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.nasdanika.core.NasdanikaException; + public class HttpContextImpl extends ContextImpl implements HttpContext { + private static final String SESSION_TRACE_ATTRIBUTE_NAME = HttpContext.class+":session-trace"; private HttpServletRequest req; private HttpServletResponse resp; private String contextURL; @@ -14,11 +28,12 @@ public HttpContextImpl( String[] path, Object target, ExtensionManager extensionManager, + List pathTrace, HttpServletRequest req, HttpServletResponse resp, String contextUrl) throws Exception { - super(principal, path, target, extensionManager); + super(principal, path, target, extensionManager, pathTrace); this.req = req; this.resp = resp; this.contextURL = contextUrl; @@ -26,14 +41,17 @@ public HttpContextImpl( @Override protected WebContext createSubContext(String[] subPath, Object target) throws Exception { - return new HttpContextImpl( + HttpContextImpl subContext = new HttpContextImpl( getPrincipal(), subPath, target, getExtensionManager(), + getPathTrace(), getRequest(), getResponse(), subContextURL(subPath, false)); + subContext.getRootObjectsPaths().putAll(getRootObjectsPaths()); + return subContext; } protected String subContextURL(String[] subPath, boolean trimExtensions) { @@ -71,4 +89,96 @@ public String getContextURL() { return contextURL; } + @Override + public Store getSessionStore() { + Store ret = (Store) req.getSession().getAttribute(Store.class.getName()); + if (ret==null) { + ret = new Store() { + + private Map storage = new HashMap<>(); + private long counter = Integer.MAX_VALUE+1; + + @Override + public synchronized Object get(String key) { + return storage.get(key); + } + + @Override + public synchronized Object remove(String key) { + return storage.remove(key); + } + + @Override + public synchronized String put(Object obj) { + String candidateKey; + try { + candidateKey = URLEncoder.encode(Integer.toString(obj.hashCode(), Character.MAX_RADIX), getCharacterEncoding()); + } catch (UnsupportedEncodingException e) { + throw new NasdanikaException(e); + } + Object atKey = storage.get(candidateKey); + if (atKey==null) { + storage.put(candidateKey, obj); + return candidateKey; + } + if (atKey.equals(obj)) { + return candidateKey; + } + for (Entry e: storage.entrySet()) { + if (obj.equals(e.getValue())) { + return e.getKey(); + } + } + do { + try { + candidateKey = URLEncoder.encode(Long.toString(++counter, Character.MAX_RADIX), getCharacterEncoding()); + } catch (UnsupportedEncodingException e) { + throw new NasdanikaException(e); + } + } while (storage.containsKey(candidateKey)); + storage.put(candidateKey, obj); + return candidateKey; + } + + }; + req.getSession().setAttribute(Store.class.getName(), ret); + } + return ret; + } + + @Override + public void addSessionTraceEntry(final String path, final String displayName) { + @SuppressWarnings("unchecked") + Queue sessionTrace = (Queue) req.getSession().getAttribute(SESSION_TRACE_ATTRIBUTE_NAME); + if (sessionTrace == null) { + sessionTrace = new ConcurrentLinkedQueue(); + req.getSession().setAttribute(SESSION_TRACE_ATTRIBUTE_NAME, sessionTrace); + } + sessionTrace.add(new TraceEntry() { + + @Override + public String getPath() { + return path; + } + + @Override + public String getDisplayName() { + return displayName; + } + }); + } + + @Override + public Collection getSessionTrace() { + @SuppressWarnings("unchecked") + Queue sessionTrace = (Queue) req.getSession().getAttribute(SESSION_TRACE_ATTRIBUTE_NAME); + return sessionTrace == null ? Collections.emptyList() : sessionTrace; + } + + @Override + public String getCharacterEncoding() { + String ret = req.getCharacterEncoding(); + return ret==null ? "UTF-8" : ret; + } + } diff --git a/org.nasdanika.web/src/org/nasdanika/web/MapObjectPathResolver.java b/org.nasdanika.web/src/org/nasdanika/web/MapObjectPathResolver.java new file mode 100644 index 00000000..630e8dc0 --- /dev/null +++ b/org.nasdanika.web/src/org/nasdanika/web/MapObjectPathResolver.java @@ -0,0 +1,21 @@ +package org.nasdanika.web; + +import java.util.HashMap; +import java.util.Map; + +import org.nasdanika.core.Context; + +public class MapObjectPathResolver implements ObjectPathResolver { + + private Map pathMap = new HashMap<>(); + + public Map getPathMap() { + return pathMap; + } + + @Override + public String resolve(Object obj, ObjectPathResolver master, Context context) { + return pathMap.get(obj); + } + +} diff --git a/org.nasdanika.web/src/org/nasdanika/web/ObjectPathResolver.java b/org.nasdanika.web/src/org/nasdanika/web/ObjectPathResolver.java new file mode 100644 index 00000000..f4a6dc3d --- /dev/null +++ b/org.nasdanika.web/src/org/nasdanika/web/ObjectPathResolver.java @@ -0,0 +1,21 @@ +package org.nasdanika.web; + +import org.nasdanika.core.Context; + +/** + * Resolves object path. + * @author Pavel + * + * @param + */ +public interface ObjectPathResolver { + + /** + * Resolves object path. + * @param obj Object + * @param master Master resolver. + * @return + */ + String resolve(T obj, ObjectPathResolver master, Context context) throws Exception; + +} diff --git a/org.nasdanika.web/src/org/nasdanika/web/RoutingServlet.java b/org.nasdanika.web/src/org/nasdanika/web/RoutingServlet.java index 1a62a936..2613d9f3 100644 --- a/org.nasdanika.web/src/org/nasdanika/web/RoutingServlet.java +++ b/org.nasdanika.web/src/org/nasdanika/web/RoutingServlet.java @@ -40,15 +40,8 @@ public void init(ServletConfig config) throws ServletException { @Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - String reqUrl = req.getRequestURL().toString(); + String reqUrl = req.getContextPath()+req.getServletPath(); String pathInfo = req.getPathInfo(); - if (pathInfo!=null) { - if (!reqUrl.endsWith(pathInfo)) { - throw new ServletException("Request URL doesn't end with path info!"); - } else { - reqUrl = reqUrl.substring(0, reqUrl.length()-pathInfo.length()); - } - } if (pathInfo==null) { pathInfo = ""; @@ -63,6 +56,7 @@ protected void service(HttpServletRequest req, HttpServletResponse resp) throws path, null, extensionManager, + null, req, resp, reqUrl); diff --git a/org.nasdanika.web/src/org/nasdanika/web/TraceEntry.java b/org.nasdanika.web/src/org/nasdanika/web/TraceEntry.java new file mode 100644 index 00000000..49ade5cb --- /dev/null +++ b/org.nasdanika.web/src/org/nasdanika/web/TraceEntry.java @@ -0,0 +1,14 @@ +package org.nasdanika.web; + +/** + * Entry for keeping trace of path hierarchy and building breadcrumbs. + * @author Pavel + * + */ +public interface TraceEntry { + + String getPath(); + + String getDisplayName(); + +} diff --git a/org.nasdanika.web/src/org/nasdanika/web/WebContext.java b/org.nasdanika.web/src/org/nasdanika/web/WebContext.java index cf28e86b..ac302dce 100644 --- a/org.nasdanika.web/src/org/nasdanika/web/WebContext.java +++ b/org.nasdanika.web/src/org/nasdanika/web/WebContext.java @@ -1,5 +1,7 @@ package org.nasdanika.web; +import java.util.Collection; +import java.util.List; import java.util.Map; import org.nasdanika.core.ConverterContext; @@ -50,10 +52,34 @@ public interface WebContext extends ConverterContext { HTMLFactory getHTMLFactory(); /** - * Resolves object URL. Optional operation. + * Resolves object path. Optional operation. * @param object * @return */ - String getObjectURL(Object object); + String getObjectPath(Object object) throws Exception; + + String getCharacterEncoding(); + + Map getRootObjectsPaths(); + + interface Store { + + Object get(String key); + + Object remove(String key); + + String put(Object obj); + + } + + Store getSessionStore(); + + List getPathTrace(); + + Collection getSessionTrace(); + + void addPathTraceEntry(String path, String displayName); + + void addSessionTraceEntry(String path, String displayName); } diff --git a/org.nasdankia.server.jetty.feature/feature.xml b/org.nasdankia.server.jetty.feature/feature.xml index da6809a3..738d97ca 100644 --- a/org.nasdankia.server.jetty.feature/feature.xml +++ b/org.nasdankia.server.jetty.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/org.nasdankia.server.jetty.feature/pom.xml b/org.nasdankia.server.jetty.feature/pom.xml index 2c33a8cf..5dc8b8d6 100644 --- a/org.nasdankia.server.jetty.feature/pom.xml +++ b/org.nasdankia.server.jetty.feature/pom.xml @@ -1,12 +1,11 @@ 4.0.0 - org.nasdankia - org.nasdankia.server.jetty.feature + org.nasdanika.server.jetty.feature eclipse-feature org.nasdanika org.nasdanika.parent - 1.0.0-SNAPSHOT + 0.1.0-SNAPSHOT ../org.nasdanika.parent \ No newline at end of file diff --git a/pom.xml b/pom.xml index 3662dc58..49d4de99 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,9 @@ pom + org.nasdanika.html + org.nasdanika.html.feature org.nasdanika.core org.nasdanika.core.tests org.nasdanika.web @@ -23,6 +25,5 @@ org.nasdanika.server.third_party.feature org.nasdankia.server.jetty.feature org.nasdanika.repository -