You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by re...@apache.org on 2015/03/22 13:11:08 UTC
[12/51] [partial] clerezza git commit: CLEREZZA-966: started
hierarchical project structure, moved platform bundles to platform,
only moved RDF artifacts ported to use commons to the rdf folder.
http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.mail/LICENSE
----------------------------------------------------------------------
diff --git a/platform.mail/LICENSE b/platform.mail/LICENSE
deleted file mode 100644
index 261eeb9..0000000
--- a/platform.mail/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) 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. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.mail/pom.xml
----------------------------------------------------------------------
diff --git a/platform.mail/pom.xml b/platform.mail/pom.xml
deleted file mode 100644
index 97cbcee..0000000
--- a/platform.mail/pom.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>clerezza</artifactId>
- <groupId>org.apache.clerezza</groupId>
- <version>0.5</version>
- <relativePath>../parent</relativePath>
- </parent>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.mail</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <packaging>bundle</packaging>
- <name>Clerezza - Platform Mail Deliverly</name>
- <description>Provides services for mail deliverly</description>
- <dependencies>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </dependency>
- <dependency>
- <artifactId>mail</artifactId>
- <groupId>javax.mail</groupId>
- <version>1.4.4</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.typerendering.core</artifactId>
- <version>0.3</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>rdf.core</artifactId>
- <version>0.14</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.stanbol</groupId>
- <artifactId>org.apache.stanbol.commons.security.core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>permissiondescriptions</artifactId>
- <version>0.2</version>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.mail/src/main/java/org/apache/clerezza/platform/mail/GraphNodeDataHandler.java
----------------------------------------------------------------------
diff --git a/platform.mail/src/main/java/org/apache/clerezza/platform/mail/GraphNodeDataHandler.java b/platform.mail/src/main/java/org/apache/clerezza/platform/mail/GraphNodeDataHandler.java
deleted file mode 100644
index 6e23e9e..0000000
--- a/platform.mail/src/main/java/org/apache/clerezza/platform/mail/GraphNodeDataHandler.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.platform.mail;
-
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.UnsupportedFlavorException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.HashMap;
-
-import javax.activation.CommandInfo;
-import javax.activation.CommandMap;
-import javax.activation.DataHandler;
-import javax.activation.DataSource;
-import org.apache.clerezza.platform.typerendering.Renderer;
-import org.apache.clerezza.rdf.utils.GraphNode;
-
-/**
- *
- * @author mir
- */
-public class GraphNodeDataHandler extends DataHandler{
-
- private GraphNode graphNode;
- private Renderer renderer;
-
-
- public GraphNodeDataHandler(GraphNode graphNode,
- Renderer renderer) {
- super(null, null);
- this.graphNode = graphNode;
- this.renderer = renderer;
- }
-
-
- @Override
- public CommandInfo[] getAllCommands() {
- throw new UnsupportedOperationException("Operation not supported 1");
- }
-
- @Override
- public Object getBean(CommandInfo arg0) {
- throw new UnsupportedOperationException("Operation not supported 2");
- }
-
- @Override
- public CommandInfo getCommand(String arg0) {
- throw new UnsupportedOperationException("Operation not supported 3");
- }
-
- @Override
- public Object getContent() throws IOException {
- throw new UnsupportedOperationException("Operation not supported 4");
- }
-
- @Override
- public String getContentType() {
- return renderer.getMediaType().toString();
- }
-
- @Override
- public DataSource getDataSource() {
- throw new UnsupportedOperationException("Operation not supported 6");
- }
-
- @Override
- public InputStream getInputStream() throws IOException {
- throw new UnsupportedOperationException("Operation not supported 7");
- }
-
- @Override
- public String getName() {
- return null;
- }
-
- @Override
- public OutputStream getOutputStream() throws IOException {
- throw new UnsupportedOperationException("Operation not supported 9");
- }
-
- @Override
- public CommandInfo[] getPreferredCommands() {
- throw new UnsupportedOperationException("Operation not supported 10");
- }
-
- @Override
- public Object getTransferData(DataFlavor arg0)
- throws UnsupportedFlavorException, IOException {
- throw new UnsupportedOperationException("Operation not supported 11");
- }
-
- @Override
- public synchronized DataFlavor[] getTransferDataFlavors() {
- throw new UnsupportedOperationException("Operation not supported 12");
- }
-
- @Override
- public boolean isDataFlavorSupported(DataFlavor arg0) {
- throw new UnsupportedOperationException("Operation not supported 13");
- }
-
- @Override
- public synchronized void setCommandMap(CommandMap arg0) {
- throw new UnsupportedOperationException("Operation not supported 14");
- }
-
- @Override
- public void writeTo(OutputStream os) throws IOException {
- renderer.render(graphNode, null, null, null, null, null, new HashMap<String, Object>(), os);
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.mail/src/main/java/org/apache/clerezza/platform/mail/MailMan.java
----------------------------------------------------------------------
diff --git a/platform.mail/src/main/java/org/apache/clerezza/platform/mail/MailMan.java b/platform.mail/src/main/java/org/apache/clerezza/platform/mail/MailMan.java
deleted file mode 100644
index 4699c4d..0000000
--- a/platform.mail/src/main/java/org/apache/clerezza/platform/mail/MailMan.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.platform.mail;
-
-import java.util.List;
-import javax.mail.MessagingException;
-import javax.mail.internet.InternetAddress;
-import javax.ws.rs.core.MediaType;
-import org.apache.clerezza.rdf.utils.GraphNode;
-
-
-/**
- * Implementations provide methods for sending emails, in particular to platform
- * users.
- *
- * @author mir
- */
-public interface MailMan {
-
- /**
- * Sends the specified message to the email address of the specified platform
- * user toUser. As sender address the email address of the fromUser is used.
- * The subject of the email will be the specified subject.
- * @param fromUser the user, which email address will be used as sender address ("from")
- * @param toUser the user to whose email address the message will be sent ("to")
- * @param subject the subject of the email
- * @param message the message of the email
- */
- public void sendEmailToUser(String fromUser, String toUser, String subject,
- String message) throws MessagingException;
-
- /**
- * Sends the rendered <code>GraphNode</code> to the email address of the specified platform
- * user toUser. As sender address the email address of the fromUser is used.
- * The subject of the email will be the specified subject.
- * An appropriate renderer for the <code>GraphNode</code> is selected on the
- * basis of the specified <code>mode</code>, <code>acceptableMediaTypes</code>
- * and the rdf-type of the graph node itself.
- * The <code>acceptableMediaTypes</code> list represent the media
- * types that are acceptable for the rendered <code>GraphNode</code>. The list has a
- * order where the most desirable media type is at the beginning of the list.
- * The media type of the rendered <code>GraphNode</code> will be compatible to at least one
- * media types in the list. <code>acceptableMediaTypes</code> and <code>mode</code> can
- * be null. <code>acceptableMediaTypes = null</code> is equivalent to a list containing
- * the media type "*\/*".
- * @param fromUser the user, which email address will be used as sender address ("from")
- * @param toUser the user to whose email address the message will be sent ("to")
- * @param subject the subject of the email
- * @param message the message of the email
- */
- public void sendEmailToUser(String fromUser, String toUser, String subject,
- GraphNode graphNode, List<MediaType> acceptableMediaTypes, String mode)
- throws MessagingException ;
-
- /**
- * Sends the specified message to the email addresses of the specified platform
- * users toUsers. As sender address the email address of the fromUser is used.
- * The subject of the email will be the specified subject. A recipient wont
- * see the addresses or names of other recipients.
- * @param fromUser the user, which email address will be used as sender address ("from")
- * @param toUsers the users to whose email addresses the message will be sent ("to")
- * @param subject the subject of the email
- * @param graphNode will be rendered and sent as message body
- * @param acceptableMediaTypes acceptable media types for the rendered output
- * @param mode the rendering mode
- */
- public void sendEmailToUsers(String fromUser, String[] toUsers,String subject,
- String message) throws MessagingException;
-
- /**
- * Sends the rendered <code>GraphNode</code> to the email addresses of the specified platform
- * users toUsers. As sender address the email address of the fromUser is used.
- * The subject of the email will be the specified subject. A recipient wont
- * see the addresses or names of other recipients.
- * An appropriate renderer for the <code>GraphNode</code> is selected on the
- * basis of the specified <code>mode</code>, <code>acceptableMediaTypes</code>
- * and the rdf-type of the graph node itself.
- * The <code>acceptableMediaTypes</code> list represent the media
- * types that are acceptable for the rendered <code>GraphNode</code>. The list has a
- * order where the most desirable media type is at the beginning of the list.
- * The media type of the rendered <code>GraphNode</code> will be compatible to at least one
- * media types in the list. <code>acceptableMediaTypes</code> and <code>mode</code> can
- * be null. <code>acceptableMediaTypes = null</code> is equivalent to a list containing
- * the media type "*\/*".
- * @param fromUser the user, which email address will be used as sender address ("from")
- * @param toUser the user to whose email address the message will be sent ("to")
- * @param subject the subject of the email
- * @param graphNode will be rendered and sent as message body
- * @param acceptableMediaTypes acceptable media types for the rendered output
- * @param mode the rendering mode
- */
- public void sendEmailToUsers(String fromUser, String[] toUsers, String subject,
- GraphNode graphNode, List<MediaType> acceptableMediaTypes, String mode)
- throws MessagingException ;
-
- /**
- * Sends an message with the specified subject to the specified
- * <code>Adress</code> to and carbon copies to the <code>Adress<code>es
- * cc and bcc (Not visible to other recipients). Cc and bcc can be null, all
- * other parameter has to be specified.
- * @param from sender address
- * @param to recipient address
- * @param cc addresess to which copies of the message will be sent to
- * @param bcc addreses to which copies of the message will be sent to,
- * but not visible to other recipients.
- * @param subject the subject of the message
- * @param message the message to be sent
- * @deprecated use javax.mail with the session returned by MailSessionFactory
- */
- @Deprecated
- public void sendEmail(InternetAddress from, InternetAddress to,
- InternetAddress[] cc, InternetAddress[] bcc, String subject,
- String message) throws MessagingException;
-
- /**
- * Sends an message with the specified subject to the specified
- * <code>Adress</code> to and carbon copies to the <code>Adress<code>es
- * cc and bcc (Not visible to other recipients). Cc and bcc can be null, all
- * other parameter has to be specified.
- * @author oliver straesser
- * @param from sender address
- * @param to recipient address
- * @param cc addresess to which copies of the message will be sent to
- * @param bcc addreses to which copies of the message will be sent to,
- * but not visible to other recipients.
- * @param subject the subject of the message
- * @param message the message to be sent
- * @deprecated use javax.mail with the session returned by MailSessionFactory
- */
- @Deprecated
- public void sendEmail(InternetAddress from, InternetAddress to,
- InternetAddress[] cc, InternetAddress[] bcc, String subject,
- String message, String mediaType) throws MessagingException;
-
- /**
- * Sends the rendered <code>GraphNode</code> with the specified subject to the specified
- * <code>Adress</code> to and carbon copies to the <code>Adress<code>es
- * cc and bcc (Not visible to other recipients). Cc and bcc can be null.
- * The <code>acceptableMediaTypes</code> list represent the media
- * types that are acceptable for the rendered <code>GraphNode</code>. The list has a
- * order where the most desirable media type is at the beginning of the list.
- * The media type of the rendered <code>GraphNode</code> will be compatible to at least one
- * media types in the list. <code>acceptableMediaTypes</code> and <code>mode</code> can
- * be null. <code>acceptableMediaTypes = null</code> is equivalent to a list containing
- * the media type "*\/*".
- * @param from sender address
- * @param to recipient address
- * @param cc addresess to which copies of the message will be sent to
- * @param bcc addreses to which copies of the message will be sent to,
- * but not visible to other recipients.
- * @param subject the subject of the message
- * @param graphNode will be rendered and sent as message body
- * @param acceptableMediaTypes acceptable media types for the rendered output
- * @param mode the rendering mode
- */
- public void sendEmail(InternetAddress from, InternetAddress to,
- InternetAddress[] cc, InternetAddress[] bcc, String subject,
- GraphNode graphNode, List<MediaType> acceptableMediaTypes, String mode)
- throws MessagingException;
-
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.mail/src/main/java/org/apache/clerezza/platform/mail/MailManImpl.java
----------------------------------------------------------------------
diff --git a/platform.mail/src/main/java/org/apache/clerezza/platform/mail/MailManImpl.java b/platform.mail/src/main/java/org/apache/clerezza/platform/mail/MailManImpl.java
deleted file mode 100644
index 827c39c..0000000
--- a/platform.mail/src/main/java/org/apache/clerezza/platform/mail/MailManImpl.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.platform.mail;
-
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
-import javax.mail.Message;
-import javax.mail.MessagingException;
-import javax.mail.Session;
-import javax.mail.Transport;
-import javax.mail.internet.AddressException;
-import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeMessage;
-import javax.ws.rs.core.MediaType;
-import org.apache.clerezza.platform.typerendering.Renderer;
-import org.apache.clerezza.platform.typerendering.RendererFactory;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.Resource;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.access.TcManager;
-import org.apache.clerezza.rdf.core.sparql.ParseException;
-import org.apache.clerezza.rdf.core.sparql.QueryParser;
-import org.apache.clerezza.rdf.core.sparql.ResultSet;
-import org.apache.clerezza.rdf.core.sparql.query.SelectQuery;
-import org.apache.clerezza.rdf.ontologies.FOAF;
-import org.apache.clerezza.rdf.ontologies.PLATFORM;
-import org.apache.clerezza.rdf.utils.GraphNode;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.Service;
-
-/**
- *
- * Implementation of <code>MailMan</code> providing utility methods to send
- * emails rendering GraphNodes
- *
- * @author mir, daniel
- */
-@Component
-@Service(MailMan.class)
-public class MailManImpl implements MailMan {
-
- @Reference
- private TcManager tcManager;
-
- @Reference
- RendererFactory rendererFactory;
-
- @Reference
- MailSessionFactory mailSessionFactory;
-
-
- private static String SYSTEM_GRAPH_URI = "urn:x-localinstance:/system.graph";
- private UriRef systemGraphUri = new UriRef(SYSTEM_GRAPH_URI);
-
- @Override
- public void sendEmailToUser(final String fromUser, final String toUser,
- final String subject, final String message) throws MessagingException {
- try {
- AccessController.checkPermission(new MailManPermission(fromUser, MailManPermission.SEND_FROM));
- AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
-
- @Override
- public Object run() throws MessagingException {
- InternetAddress fromAddress = getUserAddress(fromUser);
- InternetAddress toAddress = getUserAddress(toUser);
- sendEmail(fromAddress, toAddress, null, null, subject, message);
- return null;
- }
- });
- } catch (PrivilegedActionException ex) {
- if (ex.getException() instanceof MessagingException) {
- throw (MessagingException) ex.getException();
- } else {
- throw new RuntimeException(ex.getException());
- }
-
- }
- }
-
- @Override
- public void sendEmailToUser(final String fromUser, final String toUser,
- final String subject, final GraphNode graphNode,
- final List<MediaType> acceptableMediaTypes, final String mode)
- throws MessagingException {
- try {
- AccessController.checkPermission(
- new MailManPermission(fromUser, MailManPermission.SEND_FROM));
- AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
-
- @Override
- public Object run() throws MessagingException {
- InternetAddress fromAddress = getUserAddress(fromUser);
- InternetAddress toAddress = getUserAddress(toUser);
- sendEmail(fromAddress, toAddress, null, null, subject, graphNode,
- acceptableMediaTypes, mode);
- return null;
- }
- });
- } catch (PrivilegedActionException ex) {
- if (ex.getException() instanceof MessagingException) {
- throw (MessagingException) ex.getException();
- } else {
- throw new RuntimeException(ex.getException());
- }
- }
- }
-
- @Override
- public void sendEmailToUsers(final String fromUser, final String[] toUsers,
- final String subject, final String message) throws MessagingException {
-
- try {
- AccessController.checkPermission(
- new MailManPermission(fromUser, MailManPermission.SEND_FROM));
- AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
-
- @Override
- public Object run() throws MessagingException {
- for (int i = 0; i < toUsers.length; i++) {
- String toUser = toUsers[i];
- sendEmailToUser(fromUser, toUser, subject, message);
- }
- return null;
- }
- });
- } catch (PrivilegedActionException ex) {
- if (ex.getException() instanceof MessagingException) {
- throw (MessagingException) ex.getException();
- } else {
- throw new RuntimeException(ex.getException());
- }
- }
- }
-
- @Override
- public void sendEmailToUsers(final String fromUser, final String[] toUsers,
- final String subject, final GraphNode graphNode,
- final List<MediaType> acceptableMediaTypes, final String mode)
- throws MessagingException {
- try {
- AccessController.checkPermission(
- new MailManPermission(fromUser, MailManPermission.SEND_FROM));
- AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
-
- @Override
- public Object run() throws MessagingException {
- for (int i = 0; i < toUsers.length; i++) {
- String toUser = toUsers[i];
- sendEmailToUser(fromUser, toUser, subject, graphNode,
- acceptableMediaTypes, mode);
- }
- return null;
- }
- });
- } catch (PrivilegedActionException ex) {
- if (ex.getException() instanceof MessagingException) {
- throw (MessagingException) ex.getException();
- } else {
- throw new RuntimeException(ex.getException());
- }
- }
- }
-
- @Override
- public void sendEmail(InternetAddress from, InternetAddress to,
- InternetAddress[] cc, InternetAddress[] bcc, String subject,
- GraphNode graphNode, List<MediaType> acceptableMediaTypes,
- String mode) throws MessagingException {
- AccessController.checkPermission(
- new MailManPermission("", MailManPermission.SEND_MAIL));
- sendEmail(from, to, cc, bcc, subject, graphNode, null, acceptableMediaTypes,
- mode);
- }
-
- @Override
- public void sendEmail(InternetAddress from, InternetAddress to,
- InternetAddress[] cc, InternetAddress[] bcc, String subject,
- String message) throws MessagingException {
- AccessController.checkPermission(
- new MailManPermission("", MailManPermission.SEND_MAIL));
- sendEmail(from, to, cc, bcc, subject, message, "text/plain", null, null);
- }
-
- @Override
- public void sendEmail(InternetAddress from, InternetAddress to,
- InternetAddress[] cc, InternetAddress[] bcc, String subject,
- String message, String mediaType) throws MessagingException {
- AccessController.checkPermission(
- new MailManPermission("", MailManPermission.SEND_MAIL));
- sendEmail(from, to, cc, bcc, subject, message, mediaType, null, null);
- }
-
- private void sendEmail(final InternetAddress from, final InternetAddress to,
- final InternetAddress[] cc, final InternetAddress[] bcc,
- final String subject, final Object content, final String mediaType,
- final List<MediaType> acceptableMediaTypes, final String mode)
- throws MessagingException {
- final Session session = mailSessionFactory.getSession();
- try {
- AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
-
- @Override
- public Object run() throws MessagingException {
- MimeMessage mimeMessage = new MimeMessage(session);
- Date date = new Date();
- mimeMessage.setSentDate(date);
- mimeMessage.setSubject(subject);
- if (content instanceof GraphNode) {
- GraphNode graphNode = (GraphNode) content;
- Renderer renderer = rendererFactory.createRenderer(graphNode, mode,
- acceptableMediaTypes == null ? Collections.singletonList(
- MediaType.WILDCARD_TYPE) : acceptableMediaTypes);
- if (renderer == null) {
- throw new MessagingException("No renderer appropriate found");
- }
- mimeMessage.setDataHandler(
- new GraphNodeDataHandler(graphNode, renderer));
- } else {
- mimeMessage.setContent(content, mediaType);
- }
- mimeMessage.setFrom(from);
- if (to != null) {
- mimeMessage.addRecipient(Message.RecipientType.TO, to);
- }
- if (cc != null) {
- mimeMessage.addRecipients(Message.RecipientType.CC, cc);
- }
- if (bcc != null) {
- mimeMessage.addRecipients(Message.RecipientType.BCC, bcc);
- }
- Transport.send(mimeMessage);
- return null;
- }
- });
- } catch (PrivilegedActionException ex) {
- if (ex.getException() instanceof MessagingException) {
- throw (MessagingException) ex.getException();
- } else {
- throw new RuntimeException(ex.getException());
- }
- }
-
- }
-
-
- private InternetAddress getUserAddress(String user) throws MessagingException {
- MGraph systemGraph = tcManager.getMGraph(systemGraphUri);
-
- final String queryString = "SELECT ?email WHERE { "
- + "?x " + FOAF.mbox + " ?email . "
- + "?x " + PLATFORM.userName + " \"" + user + "\" . "
- + "}";
- try {
- SelectQuery selectQuery = (SelectQuery) QueryParser.getInstance().parse(queryString);
- ResultSet result = tcManager.executeSparqlQuery(selectQuery, systemGraph);
- if (result.hasNext()) {
- Resource email = result.next().get("email");
- String emailString = ((UriRef) email).getUnicodeString();
- //TODO should add personal name (if available) as well
- return new InternetAddress(emailString.substring("mailto:".length()));
- }
- } catch (ParseException ex) {
- throw new RuntimeException(ex);
- } catch (AddressException ex) {
- throw new RuntimeException(ex);
- }
- throw new MessagingException("No address found for user " + user);
- }
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.mail/src/main/java/org/apache/clerezza/platform/mail/MailManPermission.java
----------------------------------------------------------------------
diff --git a/platform.mail/src/main/java/org/apache/clerezza/platform/mail/MailManPermission.java b/platform.mail/src/main/java/org/apache/clerezza/platform/mail/MailManPermission.java
deleted file mode 100644
index 42db6b6..0000000
--- a/platform.mail/src/main/java/org/apache/clerezza/platform/mail/MailManPermission.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.platform.mail;
-
-import java.security.Permission;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
-import org.apache.stanbol.commons.security.UserUtil;
-
-/**
- * A permission to send e-mails as a specific user.
- *
- * @author mir
- */
-public class MailManPermission extends Permission {
- private String namePattern;
- private SortedSet<String> actions;
-
- public static final String SEND_FROM = "send from";
- public static final String SEND_MAIL = "send mail";
-
- public static final String SELF_ACTION = "<self>";
-
- public MailManPermission(String namePattern, String actions) {
- super(namePattern);
- this.namePattern = namePattern;
- this.actions = new TreeSet<String>(Arrays.asList(actions.split(",")));
- }
-
- @Override
- public boolean implies(Permission permission) {
- if (permission instanceof MailManPermission) {
- MailManPermission other = (MailManPermission) permission;
-
- if(other.actions.contains(SEND_FROM)) {
- if (!patternImplies(other.namePattern)) {
- return false;
- }
- }
- if (!actionsImplies(other.actions)) {
- return false;
- }
- return true;
-
-
- }
- return false;
- }
-
- private boolean actionsImplies(Set<String> actionsOther) {
- return actions.containsAll(actionsOther);
-
-
- }
-
- private boolean patternImplies(String namePatternOther) {
- if (namePattern.equals(namePatternOther)) {
- return true;
- }
-
- if (namePattern.equals(SELF_ACTION)) {
- String userName = UserUtil.getCurrentUserName();
- if (userName == null) {
- return false;
- }
- return userName.equals(namePatternOther);
- }
- return namePatternOther.matches(namePattern);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final MailManPermission other = (MailManPermission) obj;
- if (this.namePattern != other.namePattern
- && (this.namePattern == null
- || !this.namePattern.equals(other.namePattern))) {
- return false;
- }
- if (this.actions != other.actions
- && (this.actions == null
- || !this.actions.equals(other.actions))) {
- return false;
- }
- return true;
- }
-
- @Override
- public int hashCode() {
- int hash = 5;
- hash = 97 * hash + (this.namePattern != null ?
- this.namePattern.hashCode() : 0);
- return hash;
- }
-
-
-
- @Override
- public String getActions() {
- StringBuffer sb = new StringBuffer();
- Iterator<String> it = actions.iterator();
- while(it.hasNext()) {
- String action = it.next();
- sb.append(action);
- if (it.hasNext()) {
- sb.append(",");
- }
- }
- return sb.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.mail/src/main/java/org/apache/clerezza/platform/mail/MailPermissionDescriptionsProvider.java
----------------------------------------------------------------------
diff --git a/platform.mail/src/main/java/org/apache/clerezza/platform/mail/MailPermissionDescriptionsProvider.java b/platform.mail/src/main/java/org/apache/clerezza/platform/mail/MailPermissionDescriptionsProvider.java
deleted file mode 100644
index 7ed61c2..0000000
--- a/platform.mail/src/main/java/org/apache/clerezza/platform/mail/MailPermissionDescriptionsProvider.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.clerezza.platform.mail;
-
-import java.util.HashSet;
-import java.util.Set;
-import org.apache.clerezza.permissiondescriptions.PermissionDescriptionsProvider;
-import org.apache.clerezza.permissiondescriptions.PermissionDescripton;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Service;
-
-/**
- * <code>PermissionDescriptionsProvider</code> implementation that provides
- * <code>PermissionDescripton</code>s for the most common <code>MailManPermission<code>s
- * used.
- *
- * @author mir
- */
-@Component
-@Service(PermissionDescriptionsProvider.class)
-public class MailPermissionDescriptionsProvider implements PermissionDescriptionsProvider {
-
- private static final Set<PermissionDescripton> MAIL_PERMISSION_DESCRIPTIONS = new HashSet<PermissionDescripton>();
- static {
- MAIL_PERMISSION_DESCRIPTIONS.add(new PermissionDescripton("Send Mails From Account Permission",
- "Grants permission to the user to send emails from his/her account. The sender email address will" +
- " be the address associated to the user account.", null, MailManPermission.class,
- "(org.apache.clerezza.platform.mail.MailManPermission \"" + MailManPermission.SELF_ACTION +
- "\" \"" + MailManPermission.SEND_FROM + "\")"));
-
- MAIL_PERMISSION_DESCRIPTIONS.add(new PermissionDescripton("Send Mails Permission",
- "Grants permission to send emails. The sender email address can be freely specified. " +
- "This permission does not grant permission to send emails from any accounts.", null, MailManPermission.class,
- "(org.apache.clerezza.platform.mail.MailManPermission \"\" \"" + MailManPermission.SEND_MAIL + "\")"));
- }
-
- @Override
- public Set<PermissionDescripton> getPermissionDescriptors() {
- return MAIL_PERMISSION_DESCRIPTIONS;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.mail/src/main/java/org/apache/clerezza/platform/mail/MailSessionFactory.java
----------------------------------------------------------------------
diff --git a/platform.mail/src/main/java/org/apache/clerezza/platform/mail/MailSessionFactory.java b/platform.mail/src/main/java/org/apache/clerezza/platform/mail/MailSessionFactory.java
deleted file mode 100644
index a2b5f5c..0000000
--- a/platform.mail/src/main/java/org/apache/clerezza/platform/mail/MailSessionFactory.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.clerezza.platform.mail;
-
-
-import java.util.Properties;
-import javax.mail.Authenticator;
-import javax.mail.PasswordAuthentication;
-import javax.mail.Session;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Service;
-import org.osgi.service.component.ComponentContext;
-
-/**
- * Provides an isntance of javax.mail.Session matching the configuration of this
- * service.
- *
- * @author reto
- */
-@Component(metatype=true)
-@Service(MailSessionFactory.class)
-public class MailSessionFactory {
- /**
- * Service property
- *
- */
- @Property(value="false", description="Specifies if TLS (SSL) encryption is used.")
- public static final String MAIL_USE_TLS = "useTLS";
- /**
- * Service property
- *
- */
- @Property(value="localhost", description="Specifies the SMTP host.")
- public static final String MAIL_SMTP_HOST = "smtpHost";
- /**
- * Service property
- */
- @Property(value="25", description="Specifies the SMTP port.")
- public static final String MAIL_SMTP_PORT = "smtpPort";
- /**
- * Service property
- *
- */
- @Property(value="myPassword", description="Specifies the authentication password for SMTP.")
- public static final String MAIL_SMTP_PASSWORD = "smtpPassword";
- /**
- * Service property
- *
- */
- @Property(value="myUserName", description="Specifies the User to authenticate for SMTP.")
- public static final String MAIL_SMTP_USER = "smtpUser";
-
- private Properties properties;
-
- protected void activate(ComponentContext componentContext) {
- properties = new Properties();
- properties.setProperty("mail.debug", "false");
- if (((String) componentContext.getProperties().get(MAIL_USE_TLS)).equals("true")) {
- properties.setProperty("mail.smtp.starttls.enable", "true");
- properties.setProperty("mail.smtp.auth", "true");
- properties.setProperty("mail.smtp.socketFactory.fallback", "false");
- }
- properties.setProperty("mail.transport.protocol", "smtp");
- properties.setProperty("mail.smtp.port", (String) componentContext.getProperties().get(MAIL_SMTP_PORT));
- properties.setProperty("mail.smtp.host", (String) componentContext.getProperties().get(MAIL_SMTP_HOST));
- properties.setProperty("smtpUser", (String) componentContext.getProperties().get(MAIL_SMTP_USER));
- properties.setProperty("smtpPassword", (String) componentContext.getProperties().get(MAIL_SMTP_PASSWORD));
- }
-
- public Session getSession() {
- Authenticator auth = new Authenticator() {
- @Override
- public PasswordAuthentication getPasswordAuthentication() {
- return new PasswordAuthentication(properties.
- getProperty("smtpUser"),
- properties.getProperty("smtpPassword"));
- }
- };
- return Session.getInstance(properties, auth);
- }
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.mail/src/test/java/org/apache/clerezza/platform/mail/MailManPermissionTest.java
----------------------------------------------------------------------
diff --git a/platform.mail/src/test/java/org/apache/clerezza/platform/mail/MailManPermissionTest.java b/platform.mail/src/test/java/org/apache/clerezza/platform/mail/MailManPermissionTest.java
deleted file mode 100644
index b998c75..0000000
--- a/platform.mail/src/test/java/org/apache/clerezza/platform/mail/MailManPermissionTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.clerezza.platform.mail;
-
-import java.security.Permission;
-import java.security.PrivilegedAction;
-import java.util.Collections;
-import javax.security.auth.Subject;
-import org.junit.Test;
-import org.apache.stanbol.commons.security.auth.PrincipalImpl;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertEquals;
-/**
- *
- * @author mir
- */
-public class MailManPermissionTest {
-
- @Test
- public void testImpliesSendFrom() {
- Permission userX1 = new MailManPermission("userNameX", MailManPermission.SEND_FROM);
- Permission userX2 = new MailManPermission("userNameX", MailManPermission.SEND_FROM);
- Permission userY = new MailManPermission("userNameY", MailManPermission.SEND_FROM);
- Permission userAll = new MailManPermission("userName[A-Z]", MailManPermission.SEND_FROM);
-
- assertTrue(userX1.implies(userX2));
- assertTrue(userX1.equals(userX2));
- assertFalse(userX1.implies(userY));
- assertTrue(userAll.implies(userX1));
- assertTrue(userAll.implies(userY));
- assertFalse(userY.implies(userAll));
- }
-
- @Test
- public void testImpliesSelf() {
- final Permission userX = new MailManPermission("userNameX", MailManPermission.SEND_FROM);
- final Permission self = new MailManPermission(MailManPermission.SELF_ACTION, MailManPermission.SEND_FROM);
-
- Subject subject = new Subject(true,
- Collections.singleton(new PrincipalImpl("userNameX")),
- Collections.EMPTY_SET,
- Collections.EMPTY_SET);
- Subject.doAs(subject, new PrivilegedAction<Object>() {
- @Override
- public Object run() {
- assertTrue(self.implies(userX));
- return null;
- }
-
- });
- assertFalse(self.implies(userX));
- }
-
- @Test
- public void testImpliesSendMail() {
- Permission sendMail1 = new MailManPermission("userNameX", MailManPermission.SEND_MAIL);
- Permission sendMail2 = new MailManPermission("", MailManPermission.SEND_MAIL);
- Permission sendMailFrom = new MailManPermission("userNameY", MailManPermission.SEND_FROM +
- "," + MailManPermission.SEND_MAIL);
- Permission userY = new MailManPermission("userNameY", MailManPermission.SEND_FROM);
- assertTrue(sendMail1.implies(sendMail2));
- assertTrue(sendMailFrom.implies(sendMail1));
- assertFalse(sendMail1.implies(sendMailFrom));
- assertTrue(sendMailFrom.implies(userY));
- }
-
- @Test
- public void testGetActions() {
- Permission sendMailFrom1 = new MailManPermission("userNameY", MailManPermission.SEND_FROM +
- "," + MailManPermission.SEND_MAIL);
- Permission sendMailFrom2 = new MailManPermission("userNameY", MailManPermission.SEND_MAIL +
- "," + MailManPermission.SEND_FROM);
-
- assertEquals(sendMailFrom1.getActions(), sendMailFrom2.getActions());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.scripting.scriptmanager/LICENSE
----------------------------------------------------------------------
diff --git a/platform.scripting.scriptmanager/LICENSE b/platform.scripting.scriptmanager/LICENSE
deleted file mode 100644
index 261eeb9..0000000
--- a/platform.scripting.scriptmanager/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) 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. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.scripting.scriptmanager/pom.xml
----------------------------------------------------------------------
diff --git a/platform.scripting.scriptmanager/pom.xml b/platform.scripting.scriptmanager/pom.xml
deleted file mode 100644
index 3599016..0000000
--- a/platform.scripting.scriptmanager/pom.xml
+++ /dev/null
@@ -1,99 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>clerezza</artifactId>
- <version>0.5</version>
- <relativePath>../parent</relativePath>
- </parent>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.scripting.scriptmanager</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <packaging>bundle</packaging>
- <name>Clerezza - Platform Script Manager</name>
- <description>
- The script manager allows scripts to be uploaded, executed and deleted.
- The script manager can be found at /admin/script-manager
- (e.g. http://localhost:8282/admin/script-manager)
- </description>
- <dependencies>
- <dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>jsr311-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>rdf.core</artifactId>
- <version>0.14</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>rdf.utils</artifactId>
- <version>0.14</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>rdf.ontologies</artifactId>
- <version>0.12</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.scripting</artifactId>
- <version>0.5</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.typerendering.scalaserverpages</artifactId>
- <version>0.4</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.graphprovider.content</artifactId>
- <version>0.7</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.globalmenu.api</artifactId>
- <version>0.3</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.content</artifactId>
- <version>0.14</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>permissiondescriptions</artifactId>
- <version>0.2</version>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file