Skip to content

Commit

Permalink
Prepare publishing of winery.common including JavaDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
koppor committed Mar 1, 2018
1 parent cf710cb commit 0474376
Show file tree
Hide file tree
Showing 11 changed files with 255 additions and 107 deletions.
39 changes: 39 additions & 0 deletions org.eclipse.winery.common/pom.xml
Expand Up @@ -21,6 +21,13 @@
<version>2.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.winery.common</artifactId>
<distributionManagement>
<repository>
<id>internal.repo</id>
<name>Temporary Staging Repository</name>
<url>file://${main.basedir}/target/mvn-repo</url>
</repository>
</distributionManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<checkstyle.config.location>../checkstyle.xml</checkstyle.config.location>
Expand Down Expand Up @@ -131,6 +138,38 @@
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<altDeploymentRepository>internal.repo::default::file://${main.basedir}/target/mvn-repo
</altDeploymentRepository>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Expand Up @@ -13,47 +13,66 @@
*******************************************************************************/
package org.eclipse.winery.common;

import org.apache.commons.lang3.StringUtils;
import org.apache.taglibs.standard.functions.Functions;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import java.io.ByteArrayOutputStream;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.List;
import java.util.Objects;
import java.util.SortedMap;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.xml.XMLConstants;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchema;
import javax.xml.namespace.QName;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;

import org.eclipse.winery.common.ids.GenericId;
import org.eclipse.winery.common.ids.IdUtil;
import org.eclipse.winery.common.ids.admin.AdminId;
import org.eclipse.winery.common.ids.definitions.*;
import org.eclipse.winery.common.ids.definitions.ArtifactTemplateId;
import org.eclipse.winery.common.ids.definitions.DefinitionsChildId;
import org.eclipse.winery.common.ids.definitions.EntityTemplateId;
import org.eclipse.winery.common.ids.definitions.EntityTypeId;
import org.eclipse.winery.common.ids.definitions.EntityTypeImplementationId;
import org.eclipse.winery.common.ids.definitions.PolicyTemplateId;
import org.eclipse.winery.common.ids.definitions.ServiceTemplateId;
import org.eclipse.winery.common.ids.definitions.imports.GenericImportId;
import org.eclipse.winery.common.ids.definitions.imports.WsdlImportId;
import org.eclipse.winery.common.ids.definitions.imports.XSDImportId;
import org.eclipse.winery.common.ids.elements.ToscaElementId;
import org.eclipse.winery.model.tosca.TEntityType;
import org.eclipse.winery.model.tosca.TExtensibleElements;
import org.eclipse.winery.model.tosca.constants.Namespaces;

import org.apache.commons.lang3.StringUtils;
import org.apache.taglibs.standard.functions.Functions;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Element;

import javax.xml.XMLConstants;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchema;
import javax.xml.namespace.QName;
import javax.xml.transform.*;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.io.ByteArrayOutputStream;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Util {

public static final String FORBIDDEN_CHARACTER_REPLACEMENT = "_";
Expand Down Expand Up @@ -104,7 +123,7 @@ public static String DoubleURLencode(String s) {
/**
* Encodes the namespace and the localname of the given qname, separated by "/"
*
* @return <double encoded namespace>"/"<double encoded localname>
* @return &lt;double encoded namespace&gt;"/"&lt;double encoded localname&gt;
*/
public static String DoubleURLencode(QName qname) {
String ns = Util.DoubleURLencode(qname.getNamespaceURI());
Expand All @@ -125,7 +144,7 @@ public static boolean isRelativeURI(String uri) {
}

/**
* Do <em>not</em> use this for creating URLs. Use {@link Util#getUrlPath(org.eclipse.winery.common.ids.GenericId)
* Do <em>not</em> use this for creating URLs. Use {@link Util#getUrlPath(org.eclipse.winery.common.ids.GenericId)}
* instead.
*
* @return the path starting from the root element to the current element. Separated by "/", URLencoded, but
Expand Down Expand Up @@ -302,8 +321,8 @@ public static String getRootPathFragment(Class<? extends DefinitionsChildId> idC
/**
* Just calls @link{qname2href}
* <p>
* Introduced because of JSP error "The method qname2href(String, Class<? extends TExtensibleElements>, QName) in
* the type Util is not applicable for the arguments (String, Class<TNodeType>, QName, String)"
* Introduced because of JSP error "The method qname2href(String, Class&lt;? extends TExtensibleElements&gt;, QName) in
* the type Util is not applicable for the arguments (String, Class&lt;TNodeType&gt;, QName, String)"
*/
public static String qname2hrefWithName(String repositoryUiUrl, Class<? extends TExtensibleElements> element, QName qname, String name) {
return Util.qname2href(repositoryUiUrl, element, qname, name);
Expand Down Expand Up @@ -429,8 +448,7 @@ public static <T> JAXBElement<T> getJAXBElement(Class<T> clazz, T obj) {
}

/**
* Method similar to {@link org.eclipse.winery.repository.Utils#getXMLAsString(java.lang.Class, java.lang.Object,
* boolean)}.
* Method similar to @see org.eclipse.winery.repository.Utils#getXMLAsString(java.lang.Class, java.lang.Object, boolean)}.
* <p>
* Differences: <ul> <li>XML processing instruction is not included in the header</li> <li>JAXBcontext is created at
* each call</li> </ul>
Expand Down Expand Up @@ -490,8 +508,7 @@ public static String getXMLAsString(Element el) {
* Determines whether the instance belonging to the given id supports the "name" attribute. This cannot be done
* using the super class as the TOSCA specification treats that differently in the case of EntityTemplates
* <p>
* NOTE: The respective subclasses of AbstractComponentInstanceResource have to implement {@link
* org.eclipse.winery.repository.resources.IHasName}
* NOTE: The respective subclasses of AbstractComponentInstanceResource have to implement @see org.eclipse.winery.repository.resources.IHasName
*
* @param idClass the class of the to test
* @return true if the TOSCA model class belonging to the given id supports the method "getName()" in addition to
Expand Down Expand Up @@ -534,7 +551,7 @@ public static String makeCSSName(String namespace, String localName) {
}

/**
* @see {@link Util#makeCSSName(java.lang.String, java.lang.String)}
* See also {@link Util#makeCSSName(java.lang.String, java.lang.String)}
*/
public static String makeCSSName(QName qname) {
return Util.makeCSSName(qname.getNamespaceURI(), qname.getLocalPart());
Expand Down Expand Up @@ -596,7 +613,7 @@ private static String cleanName(String s) {
* <p>
* This function should be consistent with org.eclipse.winery.common.Util.cleanName(String)
* <p>
* TODO: This method seems to be equal to {@link org.eclipse.winery.repository.Utils.createXMLidAsString(String)}.
* TODO: This method seems to be equal to org.eclipse.winery.repository.Utils.createXMLidAsString(String).
* These methods should be merged.
*/
public static String makeNCName(String text) {
Expand Down
Expand Up @@ -14,7 +14,7 @@
package org.eclipse.winery.common.constants;

/**
* See also {@link org.eclipse.winery.repository.backend.constants.MediaTypes}
* see org.eclipse.winery.repository.backend.constants.MediaTypes
*/
public class MimeTypes {

Expand Down
Expand Up @@ -38,9 +38,9 @@ public class IdNames {
public static final String SELF_SERVICE_PORTAL = "selfserviceportal";

/**
* In this case we explicitly use '/' as a separator to get valid urls during retrieval of all files. See {@link
* org.eclipse.winery.repository.rest.resources.entitytemplates.artifacttemplates.FilesResource#getAllFileMetas()}
* and {@link org.eclipse.winery.repository.rest.datatypes.FileMeta#FileMeta(org.eclipse.winery.common.RepositoryFileReference)}
* In this case we explicitly use '/' as a separator to get valid urls during retrieval of all files. @see
* org.eclipse.winery.repository.rest.resources.entitytemplates.artifacttemplates.FilesResource#getAllFileMetas()
* and @see org.eclipse.winery.repository.rest.datatypes.FileMeta#FileMeta(org.eclipse.winery.common.RepositoryFileReference)
*/
public static final String SELF_SERVICE_PORTAL_FILES = IdNames.SELF_SERVICE_PORTAL + "/" + IdNames.FILES_DIRECTORY;

Expand Down
Expand Up @@ -93,7 +93,7 @@ public static String getPathFragment(GenericId id) {
* Returns the fragment of the URL path belonging to the id
* <p>
* For instance, an Id of type ServiceTemplateId has
* <code>servicetemplates/{double encoded ns}/{double encoded name}/</encode>
* <code>servicetemplates/{double encoded ns}/{double encoded name}/</code>
*
* @param id the element to return the path fragment for
* @return the path fragment to be used inside an URL
Expand Down
Expand Up @@ -13,16 +13,17 @@
*******************************************************************************/
package org.eclipse.winery.common.ids.definitions;

import java.util.Arrays;
import java.util.List;
import java.util.Objects;

import javax.xml.namespace.QName;

import org.eclipse.winery.common.Util;
import org.eclipse.winery.common.ids.GenericId;
import org.eclipse.winery.common.ids.Namespace;
import org.eclipse.winery.common.ids.XmlId;

import javax.xml.namespace.QName;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;

/**
* Identifies a definitions child. Each component is required to be identified
* subclasses this class
Expand All @@ -34,7 +35,7 @@
* Components are elements, which may appear directly nested in TDefinitions:
* <ul>
* <li>ServiceTemplates,</li>
* <li>EntityTypes,</li
* <li>EntityTypes,</li>
* <li>EntityTypeImplementations,</li>
* <li>EntityTemplates</li>
* </ul>
Expand Down Expand Up @@ -64,7 +65,7 @@ public DefinitionsChildId(Namespace namespace, XmlId xmlId) {
}

/**
* Creates a new id based on strings. This constructor is required for {@link org.eclipse.winery.repository.resources.AbstractComponentsResource}
* Creates a new id based on strings. This constructor is required for @see org.eclipse.winery.repository.resources.AbstractComponentsResource
*
* @param ns the namespace to be used
* @param id the id to be used
Expand Down
Expand Up @@ -21,7 +21,7 @@
/**
* Models an import of type XML Schema Definition
* <p>
* Required for a special treatment in {@link org.eclipse.winery.repository.Utils#getAllXSDefinitionsForTypeAheadSelection(short)}
* Required for a special treatment in @see org.eclipse.winery.repository.Utils#getAllXSDefinitionsForTypeAheadSelection(short)
*/
public class XSDImportId extends GenericImportId {

Expand Down
Expand Up @@ -13,25 +13,51 @@
*******************************************************************************/
package org.eclipse.winery.common.interfaces;

import org.eclipse.winery.common.ids.GenericId;
import org.eclipse.winery.common.ids.Namespace;
import org.eclipse.winery.common.ids.definitions.*;
import org.eclipse.winery.model.tosca.*;
import org.slf4j.LoggerFactory;

import javax.xml.namespace.QName;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.Objects;

import javax.xml.namespace.QName;

import org.eclipse.winery.common.ids.GenericId;
import org.eclipse.winery.common.ids.Namespace;
import org.eclipse.winery.common.ids.definitions.ArtifactTemplateId;
import org.eclipse.winery.common.ids.definitions.ArtifactTypeId;
import org.eclipse.winery.common.ids.definitions.CapabilityTypeId;
import org.eclipse.winery.common.ids.definitions.DefinitionsChildId;
import org.eclipse.winery.common.ids.definitions.NodeTypeId;
import org.eclipse.winery.common.ids.definitions.NodeTypeImplementationId;
import org.eclipse.winery.common.ids.definitions.PolicyTemplateId;
import org.eclipse.winery.common.ids.definitions.PolicyTypeId;
import org.eclipse.winery.common.ids.definitions.RelationshipTypeId;
import org.eclipse.winery.common.ids.definitions.RelationshipTypeImplementationId;
import org.eclipse.winery.common.ids.definitions.RequirementTypeId;
import org.eclipse.winery.common.ids.definitions.ServiceTemplateId;
import org.eclipse.winery.model.tosca.Definitions;
import org.eclipse.winery.model.tosca.TArtifactTemplate;
import org.eclipse.winery.model.tosca.TArtifactType;
import org.eclipse.winery.model.tosca.TCapabilityType;
import org.eclipse.winery.model.tosca.TEntityTemplate;
import org.eclipse.winery.model.tosca.TEntityType;
import org.eclipse.winery.model.tosca.TNodeType;
import org.eclipse.winery.model.tosca.TNodeTypeImplementation;
import org.eclipse.winery.model.tosca.TPolicyTemplate;
import org.eclipse.winery.model.tosca.TPolicyType;
import org.eclipse.winery.model.tosca.TRelationshipType;
import org.eclipse.winery.model.tosca.TRelationshipTypeImplementation;
import org.eclipse.winery.model.tosca.TRequirementType;
import org.eclipse.winery.model.tosca.TServiceTemplate;

import org.slf4j.LoggerFactory;

/**
* Enables access to the winery repository via Ids defined in package {@link org.eclipse.winery.common.ids}
* <p>
* Methods are moved from {@link org.eclipse.winery.repository.backend.IGenericRepository} to here as soon there is an
* Methods are moved from @see org.eclipse.winery.repository.backend.IGenericRepository to here as soon there is an
* implementation for them. The ultimate goal is to eliminate IGenericRepository
* <p>
* These methods are shared between {@link IWineryRepository} and {@link org.eclipse.winery.repository.backend.IRepository}
* These methods are shared between {@link IWineryRepository} and @see org.eclipse.winery.repository.backend.IRepository
*/
public interface IWineryRepositoryCommon {

Expand Down
Expand Up @@ -20,21 +20,6 @@
import javax.xml.bind.annotation.XmlType;


/**
* <p>Java class for anonymous complex type.
* <p>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;extension base="{http://docs.oasis-open.org/tosca/ns/2011/12}tDefinitions">
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
@XmlRootElement(name = "Definitions")
Expand Down
Expand Up @@ -201,7 +201,7 @@ public static org.eclipse.winery.model.tosca.TBoundaryDefinitions.Properties get
* Special method to get the name of an extensible element as the TOSCA specification does not have a separate super
* type for elements with a name
* <p>
* {@link Util#instanceSupportsNameAttribute(java.lang.Class)} is related
* @see Util#instanceSupportsNameAttribute(java.lang.Class) is related
*
* @param e the extensible element offering a name attribute (besides an id attribute)
* @return the name of the extensible element
Expand All @@ -222,7 +222,7 @@ public static String getName(TExtensibleElements e) {
/**
* Returns the name of the given element. If the name does not exist or is empty, the id is returned
* <p>
* {@see getName}
* {@link #getName}
*
* @return the name if there is a name field, if not, the id is returned. In case there is a Name field,
*/
Expand Down

0 comments on commit 0474376

Please sign in to comment.