You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2017/04/20 13:51:42 UTC
[08/10] syncope git commit: [SYNCOPE-808] Several pom fixes,
proper LICENSE and NOTICE, package reorganization, checkstyle setup
http://git-wip-us.apache.org/repos/asf/syncope/blob/218674e7/ide/netbeans/pom.xml
----------------------------------------------------------------------
diff --git a/ide/netbeans/pom.xml b/ide/netbeans/pom.xml
index c594e04..abaa216 100644
--- a/ide/netbeans/pom.xml
+++ b/ide/netbeans/pom.xml
@@ -16,157 +16,191 @@ specific language governing permissions and limitations
under the License.
-->
<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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.syncope</groupId>
- <artifactId>syncope-ide</artifactId>
- <version>2.0.2-SNAPSHOT</version>
- </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.syncope</groupId>
+ <artifactId>syncope-ide</artifactId>
+ <version>2.0.4-SNAPSHOT</version>
+ </parent>
- <name>Apache Syncope IDE Netbeans</name>
- <description>Apache Syncope IDE Netbeans</description>
- <groupId>org.apache.syncope.ide</groupId>
- <artifactId>syncope-ide-netbeans</artifactId>
+ <name>Apache Syncope IDE Netbeans</name>
+ <description>Apache Syncope IDE Netbeans</description>
+ <groupId>org.apache.syncope.ide</groupId>
+ <artifactId>syncope-ide-netbeans</artifactId>
- <packaging>nbm</packaging>
+ <packaging>nbm</packaging>
- <properties>
- <rootpom.basedir>${basedir}/../..</rootpom.basedir>
- </properties>
+ <properties>
+ <rootpom.basedir>${basedir}/../..</rootpom.basedir>
+ </properties>
- <build>
- <resources>
- <resource>
- <directory>src/main/resources/META-INF/</directory>
- </resource>
- </resources>
+ <dependencies>
+ <dependency>
+ <groupId>org.netbeans.api</groupId>
+ <artifactId>org-netbeans-api-annotations-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.netbeans.api</groupId>
+ <artifactId>org-openide-windows</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.netbeans.api</groupId>
+ <artifactId>org-openide-util</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.netbeans.api</groupId>
+ <artifactId>org-openide-util-ui</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.netbeans.api</groupId>
+ <artifactId>org-openide-util-lookup</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.netbeans.api</groupId>
+ <artifactId>org-openide-awt</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.netbeans.api</groupId>
+ <artifactId>org-netbeans-modules-settings</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.syncope.common</groupId>
+ <artifactId>syncope-common-lib</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.syncope.client</groupId>
+ <artifactId>syncope-client-lib</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.netbeans.api</groupId>
+ <artifactId>org-openide-io</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.netbeans.api</groupId>
+ <artifactId>org-openide-nodes</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.netbeans.api</groupId>
+ <artifactId>org-openide-text</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.netbeans.api</groupId>
+ <artifactId>org-openide-filesystems</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.netbeans.api</groupId>
+ <artifactId>org-openide-loaders</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.netbeans.api</groupId>
+ <artifactId>org-netbeans-core-multiview</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.netbeans.api</groupId>
+ <artifactId>org-netbeans-modules-editor-lib2</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.netbeans.api</groupId>
+ <artifactId>org-netbeans-api-progress</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.netbeans.api</groupId>
+ <artifactId>org-netbeans-api-progress-nb</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.netbeans.external</groupId>
+ <artifactId>asm-all-5.0.1</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>nbm-maven-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <useOSGiDependencies>false</useOSGiDependencies>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <configuration>
+ <target>
+ <zip update="true" destfile="${project.build.directory}/syncope-ide-netbeans-${project.version}.nbm">
+ <zipfileset dir="${basedir}" prefix="META-INF" includes="LICENSE,NOTICE"/>
+ </zip>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ </plugin>
+ </plugins>
+
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <targetPath>META-INF</targetPath>
+ <includes>
+ <include>LICENSE</include>
+ <include>NOTICE</include>
+ </includes>
+ </resource>
+ </resources>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>apache-release</id>
+
+ <build>
<plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>nbm-maven-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <useOSGiDependencies>false</useOSGiDependencies>
- <nbmResources>
- <nbmResource>
- <directory>src/main/resources/META-INF</directory>
- <targetPath>../META-INF</targetPath>
- </nbmResource>
- </nbmResources>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- <archive>
- <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
- </archive>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>1.7</version>
- <executions>
- <execution>
- <phase>package</phase>
- <configuration>
- <target>
- <move file="./target/syncope-ide-netbeans-2.0.2-SNAPSHOT.nbm"
- tofile="./target/syncope-ide-netbeans-2.0.2-SNAPSHOT.zip" />
- <zip update="true" basedir="legal/"
- destfile="./target/syncope-ide-netbeans-2.0.2-SNAPSHOT.zip" />
- <move file="./target/syncope-ide-netbeans-2.0.2-SNAPSHOT.zip"
- tofile="./target/syncope-ide-netbeans-2.0.2-SNAPSHOT.nbm" />
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <inherited>false</inherited>
+ <configuration>
+ <skipSource>true</skipSource>
+ </configuration>
+ </plugin>
</plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.netbeans.api</groupId>
- <artifactId>org-netbeans-api-annotations-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.netbeans.api</groupId>
- <artifactId>org-openide-windows</artifactId>
- </dependency>
- <dependency>
- <groupId>org.netbeans.api</groupId>
- <artifactId>org-openide-util</artifactId>
- </dependency>
- <dependency>
- <groupId>org.netbeans.api</groupId>
- <artifactId>org-openide-util-ui</artifactId>
- </dependency>
- <dependency>
- <groupId>org.netbeans.api</groupId>
- <artifactId>org-openide-util-lookup</artifactId>
- </dependency>
- <dependency>
- <groupId>org.netbeans.api</groupId>
- <artifactId>org-openide-awt</artifactId>
- </dependency>
- <dependency>
- <groupId>org.netbeans.api</groupId>
- <artifactId>org-netbeans-modules-settings</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.syncope.common</groupId>
- <artifactId>syncope-common-lib</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.syncope.client</groupId>
- <artifactId>syncope-client-lib</artifactId>
- </dependency>
- <dependency>
- <groupId>org.netbeans.api</groupId>
- <artifactId>org-openide-io</artifactId>
- </dependency>
- <dependency>
- <groupId>org.netbeans.api</groupId>
- <artifactId>org-openide-nodes</artifactId>
- </dependency>
- <dependency>
- <groupId>org.netbeans.api</groupId>
- <artifactId>org-openide-text</artifactId>
- </dependency>
- <dependency>
- <groupId>org.netbeans.api</groupId>
- <artifactId>org-openide-filesystems</artifactId>
- </dependency>
- <dependency>
- <groupId>org.netbeans.api</groupId>
- <artifactId>org-openide-loaders</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
- <dependency>
- <groupId>org.netbeans.api</groupId>
- <artifactId>org-netbeans-core-multiview</artifactId>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>org.netbeans.api</groupId>
- <artifactId>org-netbeans-modules-editor-lib2</artifactId>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>org.netbeans.api</groupId>
- <artifactId>org-netbeans-api-progress</artifactId>
- </dependency>
- <dependency>
- <groupId>org.netbeans.api</groupId>
- <artifactId>org-netbeans-api-progress-nb</artifactId>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
+ </build>
+ </profile>
+ </profiles>
+</project>
http://git-wip-us.apache.org/repos/asf/syncope/blob/218674e7/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/PluginConstants.java
----------------------------------------------------------------------
diff --git a/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/PluginConstants.java b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/PluginConstants.java
new file mode 100644
index 0000000..676d9a9
--- /dev/null
+++ b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/PluginConstants.java
@@ -0,0 +1,43 @@
+/*
+ * 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.syncope.ide.netbeans;
+
+import org.apache.syncope.common.lib.types.MailTemplateFormat;
+import org.apache.syncope.common.lib.types.ReportTemplateFormat;
+
+public final class PluginConstants {
+
+ public static final String MAIL_TEMPLATE = "Mail Template";
+
+ public static final String REPORT_XSLTS = "Report XSLTs";
+
+ public static final String[] MAIL_TEMPLATE_FORMATS = {
+ MailTemplateFormat.HTML.name(), MailTemplateFormat.TEXT.name() };
+
+ public static final String[] REPORT_TEMPLATE_FORMATS = {
+ ReportTemplateFormat.HTML.name(), ReportTemplateFormat.CSV.name(), ReportTemplateFormat.FO.name() };
+
+ public static final String DISPLAY_NAME = "Apache Syncope";
+
+ public static final String TOOL_TIP_TEXT = "This is a Apache Syncope window";
+
+ private PluginConstants() {
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/218674e7/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/ResourceConnector.java
----------------------------------------------------------------------
diff --git a/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/ResourceConnector.java b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/ResourceConnector.java
new file mode 100644
index 0000000..133fa8c
--- /dev/null
+++ b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/ResourceConnector.java
@@ -0,0 +1,77 @@
+/*
+ * 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.syncope.ide.netbeans;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import org.apache.syncope.ide.netbeans.service.MailTemplateManagerService;
+import org.apache.syncope.ide.netbeans.service.ReportTemplateManagerService;
+
+public final class ResourceConnector {
+
+ private static MailTemplateManagerService MAIL_TEMPLATE_MANAGER_SERVICE;
+
+ private static ReportTemplateManagerService REPORT_TEMPLATE_MANAGER_SERVICE;
+
+ private static final Object MAIL_TEMPLATE_MONITOR = new Object();
+
+ private static final Object REPORT_TEMPLATE_MONITOR = new Object();
+
+ private ResourceConnector() {
+ }
+
+ public static MailTemplateManagerService getMailTemplateManagerService() throws IOException {
+ synchronized (MAIL_TEMPLATE_MONITOR) {
+ if (MAIL_TEMPLATE_MANAGER_SERVICE == null) {
+ UserProperties userProperties = getUserProperties();
+ MAIL_TEMPLATE_MANAGER_SERVICE = new MailTemplateManagerService(
+ userProperties.getUrl(), userProperties.getUserName(),
+ userProperties.getPassword());
+ }
+ }
+ return MAIL_TEMPLATE_MANAGER_SERVICE;
+ }
+
+ public static ReportTemplateManagerService getReportTemplateManagerService() throws IOException {
+ synchronized (REPORT_TEMPLATE_MONITOR) {
+ if (REPORT_TEMPLATE_MANAGER_SERVICE == null) {
+ UserProperties userProperties = getUserProperties();
+ REPORT_TEMPLATE_MANAGER_SERVICE = new ReportTemplateManagerService(
+ userProperties.getUrl(), userProperties.getUserName(),
+ userProperties.getPassword());
+ }
+ }
+ return REPORT_TEMPLATE_MANAGER_SERVICE;
+ }
+
+ private static UserProperties getUserProperties() throws FileNotFoundException, IOException {
+ File file = new File("UserData.txt");
+ BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
+ String url = bufferedReader.readLine();
+ String userName = bufferedReader.readLine();
+ String password = bufferedReader.readLine();
+
+ UserProperties userProperties = new UserProperties(url, userName, password);
+ return userProperties;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/218674e7/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/UserProperties.java
----------------------------------------------------------------------
diff --git a/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/UserProperties.java b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/UserProperties.java
new file mode 100644
index 0000000..fdff30a
--- /dev/null
+++ b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/UserProperties.java
@@ -0,0 +1,79 @@
+/*
+ * 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.syncope.ide.netbeans;
+
+public class UserProperties {
+
+ private String url;
+
+ private String userName;
+
+ private String password;
+
+ public UserProperties() {
+ }
+
+ public UserProperties(final String url, final String userName, final String password) {
+ this.url = url;
+ this.userName = userName;
+ this.password = password;
+ }
+
+ /**
+ * @return the userName
+ */
+ public String getUserName() {
+ return userName;
+ }
+
+ /**
+ * @return the password
+ */
+ public String getPassword() {
+ return password;
+ }
+
+ /**
+ * @return the url
+ */
+ public String getUrl() {
+ return url;
+ }
+
+ /**
+ * @param url the url to set
+ */
+ public void setUrl(final String url) {
+ this.url = url;
+ }
+
+ /**
+ * @param userName the userName to set
+ */
+ public void setUserName(final String userName) {
+ this.userName = userName;
+ }
+
+ /**
+ * @param password the password to set
+ */
+ public void setPassword(final String password) {
+ this.password = password;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/218674e7/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/service/MailTemplateManagerService.java
----------------------------------------------------------------------
diff --git a/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/service/MailTemplateManagerService.java b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/service/MailTemplateManagerService.java
new file mode 100644
index 0000000..f524f1f
--- /dev/null
+++ b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/service/MailTemplateManagerService.java
@@ -0,0 +1,68 @@
+/*
+ * 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.syncope.ide.netbeans.service;
+
+import java.io.InputStream;
+import java.util.List;
+import javax.ws.rs.core.Response;
+import org.apache.syncope.client.lib.SyncopeClient;
+import org.apache.syncope.client.lib.SyncopeClientFactoryBean;
+import org.apache.syncope.common.lib.to.MailTemplateTO;
+import org.apache.syncope.common.lib.types.MailTemplateFormat;
+import org.apache.syncope.common.rest.api.service.MailTemplateService;
+
+public class MailTemplateManagerService {
+
+ private final MailTemplateService service;
+
+ public MailTemplateManagerService(final String url, final String userName, final String password) {
+ SyncopeClient syncopeClient = new SyncopeClientFactoryBean().setAddress(url).create(userName, password);
+ service = syncopeClient.getService(MailTemplateService.class);
+ }
+
+ public List<MailTemplateTO> list() {
+ return service.list();
+ }
+
+ public boolean create(final MailTemplateTO mailTemplateTO) {
+ return Response.Status.CREATED.getStatusCode() == service.create(mailTemplateTO).getStatus();
+ }
+
+ public MailTemplateTO read(final String key) {
+ return service.read(key);
+ }
+
+ public boolean delete(final String key) {
+ service.delete(key);
+ return true;
+ }
+
+ public Object getFormat(final String key, final MailTemplateFormat format) {
+ return service.getFormat(key, format).getEntity();
+ }
+
+ public void setFormat(final String key, final MailTemplateFormat format, final InputStream templateIn) {
+ service.setFormat(key, format, templateIn);
+ }
+
+ public boolean removeFormat(final String key, final MailTemplateFormat format) {
+ return false;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/218674e7/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/service/ReportTemplateManagerService.java
----------------------------------------------------------------------
diff --git a/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/service/ReportTemplateManagerService.java b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/service/ReportTemplateManagerService.java
new file mode 100644
index 0000000..6c835a1
--- /dev/null
+++ b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/service/ReportTemplateManagerService.java
@@ -0,0 +1,68 @@
+/*
+ * 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.syncope.ide.netbeans.service;
+
+import java.io.InputStream;
+import java.util.List;
+import javax.ws.rs.core.Response;
+import org.apache.syncope.client.lib.SyncopeClient;
+import org.apache.syncope.client.lib.SyncopeClientFactoryBean;
+import org.apache.syncope.common.lib.to.ReportTemplateTO;
+import org.apache.syncope.common.lib.types.ReportTemplateFormat;
+import org.apache.syncope.common.rest.api.service.ReportTemplateService;
+
+public class ReportTemplateManagerService {
+
+ private final ReportTemplateService service;
+
+ public ReportTemplateManagerService(final String url, final String userName, final String password) {
+ SyncopeClient syncopeClient = new SyncopeClientFactoryBean().setAddress(url).create(userName, password);
+ service = syncopeClient.getService(ReportTemplateService.class);
+ }
+
+ public List<ReportTemplateTO> list() {
+ return service.list();
+ }
+
+ public boolean create(final ReportTemplateTO reportTemplateTO) {
+ return Response.Status.CREATED.getStatusCode() == service.create(reportTemplateTO).getStatus();
+ }
+
+ public ReportTemplateTO read(final String key) {
+ return service.read(key);
+ }
+
+ public boolean delete(final String key) {
+ service.delete(key);
+ return true;
+ }
+
+ public Object getFormat(final String key, final ReportTemplateFormat format) {
+ return service.getFormat(key, format).getEntity();
+ }
+
+ public void setFormat(final String key, final ReportTemplateFormat format, final InputStream templateIn) {
+ service.setFormat(key, format, templateIn);
+ }
+
+ public boolean removeFormat(final String key, final ReportTemplateFormat format) {
+ return false;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/218674e7/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ResourceExplorerTopComponent.form
----------------------------------------------------------------------
diff --git a/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ResourceExplorerTopComponent.form b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ResourceExplorerTopComponent.form
new file mode 100644
index 0000000..c0b7d26
--- /dev/null
+++ b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ResourceExplorerTopComponent.form
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+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.
+-->
+<Form version="1.7" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jScrollPane1" alignment="0" pref="258" max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jScrollPane1" alignment="0" pref="445" max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JScrollPane" name="jScrollPane1">
+ <AuxValues>
+ <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+ <SubComponents>
+ <Component class="javax.swing.JTree" name="resourceExplorerTree">
+ <Properties>
+ <Property name="model" type="javax.swing.tree.TreeModel" editor="org.netbeans.modules.form.editors2.TreeModelEditor">
+ <TreeModel code=""/>
+ </Property>
+ <Property name="rootVisible" type="boolean" value="false"/>
+ <Property name="scrollsOnExpand" type="boolean" value="true"/>
+ </Properties>
+ <Events>
+ <EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="resourceExplorerTreeMouseClicked"/>
+ </Events>
+ </Component>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+</Form>
http://git-wip-us.apache.org/repos/asf/syncope/blob/218674e7/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ResourceExplorerTopComponent.java
----------------------------------------------------------------------
diff --git a/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ResourceExplorerTopComponent.java b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ResourceExplorerTopComponent.java
new file mode 100644
index 0000000..65ac347
--- /dev/null
+++ b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ResourceExplorerTopComponent.java
@@ -0,0 +1,546 @@
+/*
+ * 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.syncope.ide.netbeans.view;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseEvent;
+import java.beans.PropertyChangeListener;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.Charset;
+import java.util.List;
+import javax.swing.Action;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.JPopupMenu;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Document;
+import javax.swing.text.JTextComponent;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
+import org.apache.commons.io.IOUtils;
+import org.apache.syncope.common.lib.to.MailTemplateTO;
+import org.apache.syncope.common.lib.to.ReportTemplateTO;
+import org.apache.syncope.common.lib.types.MailTemplateFormat;
+import org.apache.syncope.common.lib.types.ReportTemplateFormat;
+import org.apache.syncope.ide.netbeans.PluginConstants;
+import org.apache.syncope.ide.netbeans.ResourceConnector;
+import org.apache.syncope.ide.netbeans.service.MailTemplateManagerService;
+import org.apache.syncope.ide.netbeans.service.ReportTemplateManagerService;
+import org.netbeans.api.editor.EditorRegistry;
+import org.netbeans.api.progress.ProgressHandle;
+import org.netbeans.api.progress.ProgressHandleFactory;
+import org.netbeans.api.settings.ConvertAsProperties;
+import org.openide.awt.ActionID;
+import org.openide.awt.ActionReference;
+import org.openide.cookies.OpenCookie;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.loaders.DataObject;
+import org.openide.util.Cancellable;
+import org.openide.util.Exceptions;
+import org.openide.util.RequestProcessor;
+import org.openide.windows.TopComponent;
+
+/**
+ * Top component which displays something.
+ */
+@ConvertAsProperties(
+ dtd = "-//org.apache.syncope.ide.netbeans//ResourceExplorer//EN",
+ autostore = false
+)
+@TopComponent.Description(
+ preferredID = "ResourceExplorerTopComponent",
+ iconBase = "images/syncope.png",
+ persistenceType = TopComponent.PERSISTENCE_ALWAYS
+)
+@TopComponent.Registration(mode = "explorer", openAtStartup = false)
+@ActionID(category = "Window", id = "org.apache.syncope.ide.netbeans.ResourceExplorerTopComponent")
+@ActionReference(path = "Menu/Window")
+@TopComponent.OpenActionRegistration(
+ displayName = "Apache Syncope",
+ preferredID = "ResourceExplorerTopComponent"
+)
+public final class ResourceExplorerTopComponent extends TopComponent {
+
+ private static final long serialVersionUID = -1643737786852621861L;
+
+ private final DefaultTreeModel treeModel;
+
+ private final DefaultMutableTreeNode root;
+
+ private final DefaultMutableTreeNode mailTemplates;
+
+ private final DefaultMutableTreeNode reportXslts;
+
+ private MailTemplateManagerService mailTemplateManagerService;
+
+ private ReportTemplateManagerService reportTemplateManagerService;
+
+ private Charset encodingPattern;
+
+ public ResourceExplorerTopComponent() {
+
+ initComponents();
+ setName(PluginConstants.DISPLAY_NAME);
+ setToolTipText(PluginConstants.TOOL_TIP_TEXT);
+
+ treeModel = (DefaultTreeModel) resourceExplorerTree.getModel();
+ root = (DefaultMutableTreeNode) treeModel.getRoot();
+ DefaultMutableTreeNode visibleRoot = new DefaultMutableTreeNode(PluginConstants.DISPLAY_NAME);
+ mailTemplates = new DefaultMutableTreeNode(PluginConstants.MAIL_TEMPLATE);
+ reportXslts = new DefaultMutableTreeNode(PluginConstants.REPORT_XSLTS);
+ root.add(visibleRoot);
+ visibleRoot.add(mailTemplates);
+ visibleRoot.add(reportXslts);
+ treeModel.reload();
+ }
+
+ /**
+ * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The
+ * content of this method is always regenerated by the Form Editor.
+ */
+ //CHECKSTYLE:OFF
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jScrollPane1 = new javax.swing.JScrollPane();
+ resourceExplorerTree = new javax.swing.JTree();
+
+ javax.swing.tree.DefaultMutableTreeNode treeNode1 = new javax.swing.tree.DefaultMutableTreeNode("root");
+ resourceExplorerTree.setModel(new javax.swing.tree.DefaultTreeModel(treeNode1));
+ resourceExplorerTree.setRootVisible(false);
+ resourceExplorerTree.setScrollsOnExpand(true);
+ resourceExplorerTree.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(java.awt.event.MouseEvent evt) {
+ resourceExplorerTreeMouseClicked(evt);
+ }
+ });
+ jScrollPane1.setViewportView(resourceExplorerTree);
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 258, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 445, Short.MAX_VALUE)
+ );
+ }// </editor-fold>//GEN-END:initComponents
+ //CHECKSTYLE:ON
+
+ private void resourceExplorerTreeMouseClicked(final java.awt.event.MouseEvent evt) {
+ if (evt.getButton() == MouseEvent.BUTTON1 && evt.getClickCount() == 2) {
+ DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) resourceExplorerTree.
+ getLastSelectedPathComponent();
+ DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) selectedNode.getParent();
+ if (selectedNode.isLeaf()) {
+ String name = (String) selectedNode.getUserObject();
+ if (parentNode.getUserObject().equals(PluginConstants.MAIL_TEMPLATE)) {
+ try {
+ openMailEditor(name);
+ } catch (IOException e) {
+ Exceptions.printStackTrace(e);
+ }
+ } else {
+ try {
+ openReportEditor(name);
+ } catch (IOException e) {
+ Exceptions.printStackTrace(e);
+ }
+ }
+ }
+ } else if (evt.getButton() == MouseEvent.BUTTON3 && evt.getClickCount() == 1) {
+ DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) resourceExplorerTree.
+ getLastSelectedPathComponent();
+ String selectedNodeName = (String) selectedNode.getUserObject();
+ if (selectedNode.isLeaf()) {
+ leafRightClickAction(evt, selectedNode);
+ } else if (selectedNodeName.equals(PluginConstants.MAIL_TEMPLATE)) {
+ folderRightClickAction(evt, mailTemplates);
+ } else if (selectedNodeName.equals(PluginConstants.REPORT_XSLTS)) {
+ folderRightClickAction(evt, reportXslts);
+ } else if (selectedNodeName.equals(PluginConstants.DISPLAY_NAME)) {
+ rootRightClickAction(evt);
+ }
+ }
+ }
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JScrollPane jScrollPane1;
+ private javax.swing.JTree resourceExplorerTree;
+ // End of variables declaration//GEN-END:variables
+
+ @Override
+ public void componentOpened() {
+ File file = new File("UserData.txt");
+ if (!file.exists()) {
+ new ServerDetailsView(null, true).setVisible(true);
+ }
+ try {
+ mailTemplateManagerService = ResourceConnector.getMailTemplateManagerService();
+ reportTemplateManagerService = ResourceConnector.getReportTemplateManagerService();
+ } catch (IOException e) {
+ JOptionPane.showMessageDialog(null, "Error Occured.", "Error", JOptionPane.ERROR_MESSAGE);
+ new ServerDetailsView(null, true).setVisible(true);
+ }
+
+ Runnable tsk = new Runnable() {
+
+ @Override
+ public void run() {
+ final ProgressHandle progr = ProgressHandleFactory.createHandle("Loading Templates", new Cancellable() {
+
+ @Override
+ public boolean cancel() {
+ return true;
+ }
+ }, new Action() {
+
+ @Override
+ public Object getValue(final String key) {
+ return null;
+ }
+
+ @Override
+ public void putValue(final String key, final Object value) {
+ }
+
+ @Override
+ public void setEnabled(final boolean b) {
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return false;
+ }
+
+ @Override
+ public void addPropertyChangeListener(final PropertyChangeListener listener) {
+ }
+
+ @Override
+ public void removePropertyChangeListener(final PropertyChangeListener listener) {
+ }
+
+ @Override
+ public void actionPerformed(final ActionEvent e) {
+ }
+ });
+
+ progr.start();
+ progr.progress("Loading Templates.");
+ addMailTemplates();
+ addReportXslts();
+ progr.finish();
+ }
+
+ };
+ RequestProcessor.getDefault().post(tsk);
+ }
+
+ @Override
+ public void componentClosed() {
+ // TODO add custom code on component closing
+ }
+
+ void writeProperties(final java.util.Properties p) {
+ // better to version settings since initial version as advocated at
+ // http://wiki.apidesign.org/wiki/PropertyFiles
+ p.setProperty("version", "1.0");
+ // TODO store your settings
+ }
+
+ void readProperties(final java.util.Properties p) {
+ String version = p.getProperty("version");
+ // TODO read your settings according to their version
+ }
+
+ private void addMailTemplates() {
+ List<MailTemplateTO> mailTemplateList = mailTemplateManagerService.list();
+ for (MailTemplateTO mailTemplate : mailTemplateList) {
+ this.mailTemplates.add(new DefaultMutableTreeNode(
+ mailTemplate.getKey()));
+ }
+ treeModel.reload();
+ }
+
+ private void addReportXslts() {
+ List<ReportTemplateTO> reportTemplates = reportTemplateManagerService.list();
+ for (ReportTemplateTO reportTemplate : reportTemplates) {
+ reportXslts.add(new DefaultMutableTreeNode(
+ reportTemplate.getKey()));
+ }
+ treeModel.reload();
+ }
+
+ private void rootRightClickAction(final MouseEvent evt) {
+ JPopupMenu menu = new JPopupMenu();
+ JMenuItem saveItem = new JMenuItem("Save");
+ JMenuItem resetConnectionItem = new JMenuItem("Reset Connection");
+ menu.add(saveItem);
+ menu.add(resetConnectionItem);
+
+ saveItem.addActionListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(final ActionEvent e) {
+ saveContent();
+ }
+ });
+
+ resetConnectionItem.addActionListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(final ActionEvent evt) {
+ File file = new File("UserData.txt");
+ try {
+ BufferedReader bf = new BufferedReader(new FileReader(file));
+ String host = bf.readLine();
+ String userName = bf.readLine();
+ String password = bf.readLine();
+ ServerDetailsView serverDetails = new ServerDetailsView(null, true);
+ serverDetails.setDetails(host, userName, password);
+ serverDetails.setVisible(true);
+ } catch (IOException e) {
+ Exceptions.printStackTrace(e);
+ }
+ }
+ });
+
+ menu.show(evt.getComponent(), evt.getX(), evt.getY());
+ }
+
+ private void folderRightClickAction(final MouseEvent evt,
+ final DefaultMutableTreeNode node) {
+ JPopupMenu menu = new JPopupMenu();
+ JMenuItem addItem = new JMenuItem("New");
+ menu.add(addItem);
+
+ addItem.addActionListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(final ActionEvent e) {
+ String name = JOptionPane.showInputDialog("Enter Name");
+ boolean added = false;
+ if (node.getUserObject().equals(PluginConstants.MAIL_TEMPLATE)) {
+ MailTemplateTO mailTemplate = new MailTemplateTO();
+ mailTemplate.setKey(name);
+ added = mailTemplateManagerService.create(mailTemplate);
+ mailTemplateManagerService.setFormat(name,
+ MailTemplateFormat.HTML,
+ IOUtils.toInputStream("//Enter Content here", encodingPattern));
+ mailTemplateManagerService.setFormat(name,
+ MailTemplateFormat.TEXT,
+ IOUtils.toInputStream("//Enter Content here", encodingPattern));
+ try {
+ openMailEditor(name);
+ } catch (IOException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ } else {
+ ReportTemplateTO reportTemplate = new ReportTemplateTO();
+ reportTemplate.setKey(name);
+ added = reportTemplateManagerService.create(reportTemplate);
+ reportTemplateManagerService.setFormat(name,
+ ReportTemplateFormat.FO,
+ IOUtils.toInputStream("//Enter content here", encodingPattern));
+ reportTemplateManagerService.setFormat(name,
+ ReportTemplateFormat.CSV,
+ IOUtils.toInputStream("//Enter content here", encodingPattern));
+ reportTemplateManagerService.setFormat(name,
+ ReportTemplateFormat.HTML,
+ IOUtils.toInputStream("//Enter content here", encodingPattern));
+ try {
+ openReportEditor(name);
+ } catch (IOException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ }
+
+ if (added) {
+ node.add(new DefaultMutableTreeNode(name));
+ treeModel.reload(node);
+ } else {
+ JOptionPane.showMessageDialog(
+ null, "Error while creating new element", "Error", JOptionPane.ERROR_MESSAGE);
+ }
+ }
+ });
+
+ menu.show(evt.getComponent(), evt.getX(), evt.getY());
+ }
+
+ private void leafRightClickAction(final MouseEvent evt,
+ final DefaultMutableTreeNode node) {
+ JPopupMenu menu = new JPopupMenu();
+ JMenuItem deleteItem = new JMenuItem("Delete");
+ menu.add(deleteItem);
+
+ deleteItem.addActionListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(final ActionEvent e) {
+ int result = JOptionPane.showConfirmDialog(null, "Do you want to delete ?");
+ if (result == JOptionPane.OK_OPTION) {
+ DefaultMutableTreeNode parent = (DefaultMutableTreeNode) node.getParent();
+ boolean deleted;
+ if (parent.getUserObject().equals(PluginConstants.MAIL_TEMPLATE)) {
+ deleted = mailTemplateManagerService.delete((String) node.getUserObject());
+ } else {
+ deleted = reportTemplateManagerService.delete((String) node.getUserObject());
+ }
+ if (deleted) {
+ node.removeFromParent();
+ treeModel.reload(parent);
+ } else {
+ JOptionPane.showMessageDialog(
+ null, "Error while deleting new element", "Error", JOptionPane.ERROR_MESSAGE);
+ }
+ }
+ }
+ });
+
+ menu.show(evt.getComponent(), evt.getX(), evt.getY());
+ }
+
+ private void openMailEditor(final String name) throws IOException {
+ String formatStr = (String) JOptionPane.showInputDialog(null, "Select File Format",
+ "File format", JOptionPane.QUESTION_MESSAGE, null,
+ PluginConstants.MAIL_TEMPLATE_FORMATS, MailTemplateFormat.TEXT.name());
+ MailTemplateFormat format = MailTemplateFormat.valueOf(formatStr);
+
+ String type = null;
+ InputStream is = null;
+ switch (format) {
+ case HTML:
+ type = "html";
+ is = (InputStream) mailTemplateManagerService.getFormat(name, MailTemplateFormat.HTML);
+ break;
+ case TEXT:
+ type = "txt";
+ is = (InputStream) mailTemplateManagerService.getFormat(name, MailTemplateFormat.TEXT);
+ break;
+ default:
+ break;
+ }
+ String content = IOUtils.toString(is, encodingPattern);
+
+ File directory = new File("Template/Mail");
+ if (!directory.exists()) {
+ directory.mkdirs();
+ }
+ File file = new File("Template/Mail/" + name + "." + type);
+ FileWriter fw = new FileWriter(file);
+ fw.write(content);
+ fw.flush();
+ FileObject fob = FileUtil.toFileObject(file.getAbsoluteFile());
+ fob.setAttribute("description", "TEXT");
+ DataObject data = DataObject.find(fob);
+ data.getLookup().lookup(OpenCookie.class).open();
+ }
+
+ private void openReportEditor(final String name) throws IOException {
+ String formatStr = (String) JOptionPane.showInputDialog(null, "Select File Format",
+ "File format", JOptionPane.QUESTION_MESSAGE, null,
+ PluginConstants.REPORT_TEMPLATE_FORMATS, ReportTemplateFormat.FO.name());
+ ReportTemplateFormat format = ReportTemplateFormat.valueOf(formatStr);
+
+ String type = null;
+ InputStream is = null;
+ switch (format) {
+ case HTML:
+ type = "html";
+ is = (InputStream) reportTemplateManagerService.getFormat(name, ReportTemplateFormat.HTML);
+ break;
+ case CSV:
+ type = "csv";
+ is = (InputStream) reportTemplateManagerService.getFormat(name, ReportTemplateFormat.CSV);
+ break;
+ case FO:
+ type = "fo";
+ is = (InputStream) reportTemplateManagerService.getFormat(name, ReportTemplateFormat.FO);
+ break;
+ default:
+ break;
+ }
+ String content = IOUtils.toString(is, encodingPattern);
+
+ File directory = new File("Template/Report");
+ if (!directory.exists()) {
+ directory.mkdirs();
+ }
+ File file = new File("Template/Report/" + name + "." + type);
+ FileWriter fw = new FileWriter(file);
+ fw.write(content);
+ fw.flush();
+ FileObject fob = FileUtil.toFileObject(file.getAbsoluteFile());
+ DataObject data = DataObject.find(fob);
+ data.getLookup().lookup(OpenCookie.class).open();
+ }
+
+ private void saveContent() {
+ try {
+ JTextComponent ed = EditorRegistry.lastFocusedComponent();
+ Document document = ed.getDocument();
+ String content = document.getText(0, document.getLength());
+ String path = (String) document.getProperty(Document.TitleProperty);
+ String[] temp = path.split(File.separator);
+ String name = temp[temp.length - 1];
+ String templateType = temp[temp.length - 2];
+ temp = name.split("\\.");
+ String format = temp[1];
+ String key = temp[0];
+
+ if (templateType.equals("Mail")) {
+ if (format.equals("txt")) {
+ mailTemplateManagerService.setFormat(key,
+ MailTemplateFormat.TEXT,
+ IOUtils.toInputStream(content, encodingPattern));
+ } else {
+ mailTemplateManagerService.setFormat(key,
+ MailTemplateFormat.HTML,
+ IOUtils.toInputStream(content, encodingPattern));
+ }
+ } else if (format.equals("html")) {
+ reportTemplateManagerService.setFormat(key,
+ ReportTemplateFormat.HTML,
+ IOUtils.toInputStream(content, encodingPattern));
+ } else if (format.equals("fo")) {
+ reportTemplateManagerService.setFormat(key,
+ ReportTemplateFormat.FO,
+ IOUtils.toInputStream(content, encodingPattern));
+ } else {
+ reportTemplateManagerService.setFormat(key,
+ ReportTemplateFormat.CSV,
+ IOUtils.toInputStream(content, encodingPattern));
+ }
+ } catch (BadLocationException e) {
+ Exceptions.printStackTrace(e);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/218674e7/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ServerDetailsView.form
----------------------------------------------------------------------
diff --git a/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ServerDetailsView.form b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ServerDetailsView.form
new file mode 100644
index 0000000..d6ba1d7
--- /dev/null
+++ b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ServerDetailsView.form
@@ -0,0 +1,161 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+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.
+-->
+<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
+ <Properties>
+ <Property name="defaultCloseOperation" type="int" value="2"/>
+ </Properties>
+ <SyntheticProperties>
+ <SyntheticProperty name="formSizePolicy" type="int" value="1"/>
+ <SyntheticProperty name="generateCenter" type="boolean" value="false"/>
+ </SyntheticProperties>
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace min="-2" pref="41" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="1" attributes="0">
+ <Component id="okButton" min="-2" pref="74" max="-2" attributes="0"/>
+ <Group type="102" attributes="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
+ <Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
+ <Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace min="-2" pref="39" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" max="-2" attributes="0">
+ <Component id="userNameTxt" max="32767" attributes="0"/>
+ <Component id="urlTxt" max="32767" attributes="0"/>
+ <Component id="passwordTxt" alignment="0" min="-2" pref="155" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </Group>
+ </Group>
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace min="-2" pref="101" max="-2" attributes="0"/>
+ <Component id="jLabel4" min="-2" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ <EmptySpace pref="41" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="1" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jLabel4" pref="32" max="32767" attributes="0"/>
+ <EmptySpace type="separate" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="urlTxt" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace type="separate" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="userNameTxt" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace type="separate" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="passwordTxt" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="okButton" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="jLabel1">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/apache/syncope/ide/netbeans/view/Bundle.properties" key="ServerDetailsView.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="jLabel2">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/apache/syncope/ide/netbeans/view/Bundle.properties" key="ServerDetailsView.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="jLabel3">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/apache/syncope/ide/netbeans/view/Bundle.properties" key="ServerDetailsView.jLabel3.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="urlTxt">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/apache/syncope/ide/netbeans/view/Bundle.properties" key="ServerDetailsView.urlTxt.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="userNameTxt">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/apache/syncope/ide/netbeans/view/Bundle.properties" key="ServerDetailsView.userNameTxt.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JPasswordField" name="passwordTxt">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/apache/syncope/ide/netbeans/view/Bundle.properties" key="ServerDetailsView.passwordTxt.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JButton" name="okButton">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/apache/syncope/ide/netbeans/view/Bundle.properties" key="ServerDetailsView.okButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="okButtonActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JLabel" name="jLabel4">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/apache/syncope/ide/netbeans/view/Bundle.properties" key="ServerDetailsView.jLabel4.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ </SubComponents>
+</Form>
http://git-wip-us.apache.org/repos/asf/syncope/blob/218674e7/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ServerDetailsView.java
----------------------------------------------------------------------
diff --git a/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ServerDetailsView.java b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ServerDetailsView.java
new file mode 100644
index 0000000..07aedf9
--- /dev/null
+++ b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ServerDetailsView.java
@@ -0,0 +1,183 @@
+/*
+ * 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.syncope.ide.netbeans.view;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import javax.swing.JDialog;
+import javax.swing.JOptionPane;
+
+public class ServerDetailsView extends JDialog {
+
+ private static final long serialVersionUID = -8693554903195406915L;
+
+ /**
+ * Creates new form LoginView
+ */
+ public ServerDetailsView(final java.awt.Frame parent, final boolean modal) {
+ super(parent, modal);
+ initComponents();
+ setLocationRelativeTo(this);
+ }
+
+ /**
+ * This method is called from within the constructor to initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is always
+ * regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ //CHECKSTYLE:OFF
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jLabel1 = new javax.swing.JLabel();
+ jLabel2 = new javax.swing.JLabel();
+ jLabel3 = new javax.swing.JLabel();
+ urlTxt = new javax.swing.JTextField();
+ userNameTxt = new javax.swing.JTextField();
+ passwordTxt = new javax.swing.JPasswordField();
+ okButton = new javax.swing.JButton();
+ jLabel4 = new javax.swing.JLabel();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
+
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(ServerDetailsView.class, "ServerDetailsView.jLabel1.text")); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(ServerDetailsView.class, "ServerDetailsView.jLabel2.text")); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(ServerDetailsView.class, "ServerDetailsView.jLabel3.text")); // NOI18N
+
+ urlTxt.setText(org.openide.util.NbBundle.getMessage(ServerDetailsView.class, "ServerDetailsView.urlTxt.text")); // NOI18N
+
+ userNameTxt.setText(org.openide.util.NbBundle.getMessage(ServerDetailsView.class, "ServerDetailsView.userNameTxt.text")); // NOI18N
+
+ passwordTxt.setText(org.openide.util.NbBundle.getMessage(ServerDetailsView.class, "ServerDetailsView.passwordTxt.text")); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(okButton, org.openide.util.NbBundle.getMessage(ServerDetailsView.class, "ServerDetailsView.okButton.text")); // NOI18N
+ okButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ okButtonActionPerformed(evt);
+ }
+ });
+
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(ServerDetailsView.class, "ServerDetailsView.jLabel4.text")); // NOI18N
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addGap(41, 41, 41)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(okButton, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jLabel1)
+ .addComponent(jLabel2)
+ .addComponent(jLabel3))
+ .addGap(39, 39, 39)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addComponent(userNameTxt)
+ .addComponent(urlTxt)
+ .addComponent(passwordTxt, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)))))
+ .addGroup(layout.createSequentialGroup()
+ .addGap(101, 101, 101)
+ .addComponent(jLabel4)))
+ .addContainerGap(41, Short.MAX_VALUE))
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE)
+ .addGap(18, 18, 18)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel1)
+ .addComponent(urlTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(18, 18, 18)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel2)
+ .addComponent(userNameTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(18, 18, 18)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel3)
+ .addComponent(passwordTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(okButton)
+ .addContainerGap())
+ );
+
+ pack();
+ }// </editor-fold>//GEN-END:initComponents
+ //CHECKSTYLE:ON
+
+ private void okButtonActionPerformed(final java.awt.event.ActionEvent evt) {
+ String url = urlTxt.getText();
+ String userName = userNameTxt.getText();
+ String password = new String(passwordTxt.getPassword());
+ File file = new File("UserData.txt");
+ try {
+ FileWriter fileWriter = new FileWriter(file);
+ fileWriter.write(url + "\n" + userName + "\n" + password);
+ fileWriter.flush();
+ this.dispose();
+ } catch (IOException ex) {
+ JOptionPane.showMessageDialog(this, "Error while saving Data.", "Error", JOptionPane.ERROR_MESSAGE);
+ }
+ }
+
+ public void setDetails(final String host, final String userName, final String password) {
+ urlTxt.setText(host);
+ userNameTxt.setText(userName);
+ passwordTxt.setText(password);
+ }
+
+ public static void main(final String[] args) {
+ /* Create and display the dialog */
+ java.awt.EventQueue.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+ ServerDetailsView dialog = new ServerDetailsView(new javax.swing.JFrame(), true);
+ dialog.addWindowListener(new java.awt.event.WindowAdapter() {
+
+ @Override
+ public void windowClosing(final java.awt.event.WindowEvent e) {
+ System.exit(0);
+ }
+ });
+ dialog.setVisible(true);
+ }
+ });
+ }
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel2;
+ private javax.swing.JLabel jLabel3;
+ private javax.swing.JLabel jLabel4;
+ private javax.swing.JButton okButton;
+ private javax.swing.JPasswordField passwordTxt;
+ private javax.swing.JTextField urlTxt;
+ private javax.swing.JTextField userNameTxt;
+ // End of variables declaration//GEN-END:variables
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/218674e7/ide/netbeans/src/main/java/org/apache/syncope/netbeans/plugin/connector/ResourceConnector.java
----------------------------------------------------------------------
diff --git a/ide/netbeans/src/main/java/org/apache/syncope/netbeans/plugin/connector/ResourceConnector.java b/ide/netbeans/src/main/java/org/apache/syncope/netbeans/plugin/connector/ResourceConnector.java
deleted file mode 100644
index f9c4c13..0000000
--- a/ide/netbeans/src/main/java/org/apache/syncope/netbeans/plugin/connector/ResourceConnector.java
+++ /dev/null
@@ -1,76 +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.syncope.netbeans.plugin.connector;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import org.apache.syncope.netbeans.plugin.entity.UserProperties;
-import org.apache.syncope.netbeans.plugin.service.MailTemplateManagerService;
-import org.apache.syncope.netbeans.plugin.service.ReportTemplateManagerService;
-
-public final class ResourceConnector {
-
- private static MailTemplateManagerService MAIL_TEMPLATE_MANAGER_SERVICE;
- private static ReportTemplateManagerService REPORT_TEMPLATE_MANAGER_SERVICE;
-
- private static final Object MAIL_TEMPLATE_MONITOR = new Object();
- private static final Object REPORT_TEMPLATE_MONITOR = new Object();
-
- private ResourceConnector() {
- }
-
- public static MailTemplateManagerService getMailTemplateManagerService() throws IOException {
- synchronized (MAIL_TEMPLATE_MONITOR) {
- if (MAIL_TEMPLATE_MANAGER_SERVICE == null) {
- UserProperties userProperties = getUserProperties();
- MAIL_TEMPLATE_MANAGER_SERVICE = new MailTemplateManagerService(
- userProperties.getUrl(), userProperties.getUserName(),
- userProperties.getPassword());
- }
- }
- return MAIL_TEMPLATE_MANAGER_SERVICE;
- }
-
- public static ReportTemplateManagerService getReportTemplateManagerService() throws IOException {
- synchronized (REPORT_TEMPLATE_MONITOR) {
- if (REPORT_TEMPLATE_MANAGER_SERVICE == null) {
- UserProperties userProperties = getUserProperties();
- REPORT_TEMPLATE_MANAGER_SERVICE = new ReportTemplateManagerService(
- userProperties.getUrl(), userProperties.getUserName(),
- userProperties.getPassword());
- }
- }
- return REPORT_TEMPLATE_MANAGER_SERVICE;
- }
-
- private static UserProperties getUserProperties() throws FileNotFoundException, IOException {
- File file = new File("UserData.txt");
- BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
- String url = bufferedReader.readLine();
- String userName = bufferedReader.readLine();
- String password = bufferedReader.readLine();
-
- UserProperties userProperties = new UserProperties(url, userName, password);
- return userProperties;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/218674e7/ide/netbeans/src/main/java/org/apache/syncope/netbeans/plugin/constants/PluginConstants.java
----------------------------------------------------------------------
diff --git a/ide/netbeans/src/main/java/org/apache/syncope/netbeans/plugin/constants/PluginConstants.java b/ide/netbeans/src/main/java/org/apache/syncope/netbeans/plugin/constants/PluginConstants.java
deleted file mode 100644
index 50976d7..0000000
--- a/ide/netbeans/src/main/java/org/apache/syncope/netbeans/plugin/constants/PluginConstants.java
+++ /dev/null
@@ -1,33 +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.syncope.netbeans.plugin.constants;
-
-public final class PluginConstants {
-
- public static final String MAIL_TEMPLTAE_CONSTANT = "Mail Template";
- public static final String REPORT_XSLTS_CONSTANT = "Report XSLTs";
- public static final String[] MAIL_TEMPLATE_FORMATS = {"TEXT", "HTML"};
- public static final String[] REPORT_TEMPLATE_FORMATS = {"HTML", "CSV", "FO"};
- public static final String DISPLAY_NAME = "Apache Syncope";
- public static final String TOOL_TIP_TEXT = "This is a Apache Syncope window";
-
- private PluginConstants() {
- }
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/218674e7/ide/netbeans/src/main/java/org/apache/syncope/netbeans/plugin/entity/UserProperties.java
----------------------------------------------------------------------
diff --git a/ide/netbeans/src/main/java/org/apache/syncope/netbeans/plugin/entity/UserProperties.java b/ide/netbeans/src/main/java/org/apache/syncope/netbeans/plugin/entity/UserProperties.java
deleted file mode 100644
index 9bb0845..0000000
--- a/ide/netbeans/src/main/java/org/apache/syncope/netbeans/plugin/entity/UserProperties.java
+++ /dev/null
@@ -1,78 +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.syncope.netbeans.plugin.entity;
-
-public class UserProperties {
-
- private String url;
- private String userName;
- private String password;
-
- public UserProperties() {
- }
-
- public UserProperties(final String url, final String userName,
- final String password) {
- this.url = url;
- this.userName = userName;
- this.password = password;
- }
-
- /**
- * @return the userName
- */
- public String getUserName() {
- return userName;
- }
-
- /**
- * @return the password
- */
- public String getPassword() {
- return password;
- }
-
- /**
- * @return the url
- */
- public String getUrl() {
- return url;
- }
-
- /**
- * @param url the url to set
- */
- public void setUrl(final String url) {
- this.url = url;
- }
-
- /**
- * @param userName the userName to set
- */
- public void setUserName(final String userName) {
- this.userName = userName;
- }
-
- /**
- * @param password the password to set
- */
- public void setPassword(final String password) {
- this.password = password;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/218674e7/ide/netbeans/src/main/java/org/apache/syncope/netbeans/plugin/service/MailTemplateManagerService.java
----------------------------------------------------------------------
diff --git a/ide/netbeans/src/main/java/org/apache/syncope/netbeans/plugin/service/MailTemplateManagerService.java b/ide/netbeans/src/main/java/org/apache/syncope/netbeans/plugin/service/MailTemplateManagerService.java
deleted file mode 100644
index 953d081..0000000
--- a/ide/netbeans/src/main/java/org/apache/syncope/netbeans/plugin/service/MailTemplateManagerService.java
+++ /dev/null
@@ -1,68 +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.syncope.netbeans.plugin.service;
-
-import java.io.InputStream;
-import java.util.List;
-import javax.ws.rs.core.Response;
-import org.apache.syncope.client.lib.SyncopeClient;
-import org.apache.syncope.client.lib.SyncopeClientFactoryBean;
-import org.apache.syncope.common.lib.to.MailTemplateTO;
-import org.apache.syncope.common.lib.types.MailTemplateFormat;
-import org.apache.syncope.common.rest.api.service.MailTemplateService;
-
-public class MailTemplateManagerService {
-
- private MailTemplateService service;
-
- public MailTemplateManagerService(final String url, final String userName, final String password) {
- SyncopeClient syncopeClient = new SyncopeClientFactoryBean().setAddress(url).create(userName, password);
- service = syncopeClient.getService(MailTemplateService.class);
- }
-
- public List<MailTemplateTO> list() {
- return service.list();
- }
-
- public boolean create(final MailTemplateTO mailTemplateTO) {
- return Response.Status.CREATED.getStatusCode() == service.create(mailTemplateTO).getStatus();
- }
-
- public MailTemplateTO read(final String key) {
- return service.read(key);
- }
-
- public boolean delete(final String key) {
- service.delete(key);
- return true;
- }
-
- public Object getFormat(final String key, final MailTemplateFormat format) {
- return service.getFormat(key, format).getEntity();
- }
-
- public void setFormat(final String key, final MailTemplateFormat format, final InputStream templateIn) {
- service.setFormat(key, format, templateIn);
- }
-
- public boolean removeFormat(final String key, final MailTemplateFormat format) {
- return false;
- }
-
-}