ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovi...@apache.org
Subject [07/17] ignite git commit: IGNITE-3262 Added service stubs.
Date Fri, 08 Jul 2016 06:27:53 GMT
IGNITE-3262 Added service stubs.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bfdbfd0d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bfdbfd0d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bfdbfd0d

Branch: refs/heads/ignite-3262
Commit: bfdbfd0d6a0d1872e658302927a888731688579b
Parents: 31727b9
Author: Maxim Afanasiev <mafkus@gmail.com>
Authored: Tue Jul 5 10:28:31 2016 +0700
Committer: Maxim Afanasiev <mafkus@gmail.com>
Committed: Tue Jul 5 10:28:31 2016 +0700

----------------------------------------------------------------------
 .../src/main/js/serve/routes/routes.js          |  1 +
 .../src/main/js/serve/services/account.js       | 77 ++++++++++++++++++++
 .../src/main/js/serve/services/agent.js         | 40 ++++++++++
 .../src/main/js/serve/services/auth.js          | 42 +++++++++++
 .../src/main/js/serve/services/cluster.js       | 69 ++++++++++++++++++
 .../src/main/js/serve/services/domain.js        | 77 ++++++++++++++++++++
 .../src/main/js/serve/services/igfs.js          | 69 ++++++++++++++++++
 .../src/main/js/serve/services/mail.js          | 55 ++++++++++++++
 .../src/main/js/serve/services/notebook.js      | 71 ++++++++++++++++++
 .../src/main/js/serve/services/session.js       | 47 ++++++++++++
 10 files changed, 548 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/bfdbfd0d/modules/web-console/src/main/js/serve/routes/routes.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/serve/routes/routes.js b/modules/web-console/src/main/js/serve/routes/routes.js
index cbee8bb..a6fb188 100644
--- a/modules/web-console/src/main/js/serve/routes/routes.js
+++ b/modules/web-console/src/main/js/serve/routes/routes.js
@@ -40,6 +40,7 @@ module.exports.factory = function(publicRoutes, adminRoutes, profileRoutes,
demo
     clusterRoutes, domainRoutes, cacheRoutes, igfsRoutes, notebookRoutes, agentRoutes, pluginRoutes)
{
     return {
         register: (app) => {
+            // TODO Extract this to separate middleware.
             app.all('*', (req, res, next) => {
                 req.currentUserId = () => {
                     if (!req.user)

http://git-wip-us.apache.org/repos/asf/ignite/blob/bfdbfd0d/modules/web-console/src/main/js/serve/services/account.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/serve/services/account.js b/modules/web-console/src/main/js/serve/services/account.js
new file mode 100644
index 0000000..49d9e59
--- /dev/null
+++ b/modules/web-console/src/main/js/serve/services/account.js
@@ -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.
+ */
+
+'use strict';
+
+// Fire me up!
+
+module.exports = {
+    implements: 'services/account',
+    inject: ['require(lodash)', 'mongo', 'services/space', 'errors']
+};
+
+module.exports.factory = (_, mongo, spaceService, errors) => {
+    class AccountService {
+
+        /**
+         * Create or update account.
+         * @param {Object} account - The account
+         * @returns {Promise.<mongo.ObjectId>} that resolves account id of merge operation.
+         */
+        static merge(account) {
+
+        }
+
+        /**
+         * Save profile information.
+         * @param {Object} account - The account
+         * @returns {Promise.<mongo.ObjectId>} that resolves account id of merge operation.
+         */
+        // TODO move profile saving logic from profile router || merge with save logic.
+        static profile(account) {
+
+        }
+
+        /**
+         * Get list of user accounts and summary information.
+         * @returns {mongo.Account[]} - returns all accounts with counters object
+         */
+        static list() {
+
+        }
+
+        /**
+         * Remove account.
+         * @param {mongo.ObjectId|String} accountId - The account id for remove.
+         * @returns {Promise.<{rowsAffected}>} - The number of affected rows.
+         */
+        static remove(accountId) {
+
+        }
+        
+
+        /**
+         * Get account information.
+         */
+        static get() {
+
+        }
+
+    }
+
+    return AccountService;
+};

http://git-wip-us.apache.org/repos/asf/ignite/blob/bfdbfd0d/modules/web-console/src/main/js/serve/services/agent.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/serve/services/agent.js b/modules/web-console/src/main/js/serve/services/agent.js
new file mode 100644
index 0000000..23a858c
--- /dev/null
+++ b/modules/web-console/src/main/js/serve/services/agent.js
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+'use strict';
+
+// Fire me up!
+
+module.exports = {
+    implements: 'services/agent',
+    inject: ['require(lodash)', 'mongo', 'services/space', 'errors']
+};
+
+module.exports.factory = (_, mongo, spaceService, errors) => {
+    class AgentService {
+
+        /**
+         * Get agent archive with user agent configuration.
+         * @returns {stream.Readable} - readable stream for further piping. (http://stuk.github.io/jszip/documentation/api_jszip/generate_node_stream.html)
+         */
+        static getArchive(token, serverUrl) {
+
+        }
+    }
+
+    return AgentService;
+};

http://git-wip-us.apache.org/repos/asf/ignite/blob/bfdbfd0d/modules/web-console/src/main/js/serve/services/auth.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/serve/services/auth.js b/modules/web-console/src/main/js/serve/services/auth.js
new file mode 100644
index 0000000..0077303
--- /dev/null
+++ b/modules/web-console/src/main/js/serve/services/auth.js
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+
+'use strict';
+
+// Fire me up!
+
+module.exports = {
+    implements: 'services/auth',
+    inject: ['require(lodash)', 'mongo', 'services/space', 'errors']
+};
+
+module.exports.factory = (_, mongo, spaceService, errors) => {
+    class AuthService {
+
+        // TODO move implementation from public router.
+        static resetPassword() {
+
+        }
+
+        static validateResetToken() {
+
+        }
+
+    }
+
+    return AuthService;
+};

http://git-wip-us.apache.org/repos/asf/ignite/blob/bfdbfd0d/modules/web-console/src/main/js/serve/services/cluster.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/serve/services/cluster.js b/modules/web-console/src/main/js/serve/services/cluster.js
new file mode 100644
index 0000000..8a89303
--- /dev/null
+++ b/modules/web-console/src/main/js/serve/services/cluster.js
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ */
+
+'use strict';
+
+// Fire me up!
+
+module.exports = {
+    implements: 'services/cluster',
+    inject: ['require(lodash)', 'mongo', 'services/space', 'errors']
+};
+
+module.exports.factory = (_, mongo, spaceService, errors) => {
+    class ClusterService {
+        /**
+         * Create or update cluster.
+         * @param {Object} cluster - The cluster
+         * @returns {Promise.<mongo.ObjectId>} that resolves cluster id of merge operation.
+         */
+        static merge(cluster) {
+
+        }
+
+        /**
+         * Get clusters and linked objects by user.
+         * @param {mongo.ObjectId|String} userId - The user id that own cluster.
+         * @param {Boolean} demo - The flag indicates that need lookup in demo space.
+         * @returns {Promise.<[mongo.Cache[], mongo.Cluster[], mongo.DomainModel[], mongo.Space[]]>}
- contains requested caches and array of linked objects: clusters, domains, spaces.
+         */
+        static listByUser(userId, demo) {
+
+        }
+
+        /**
+         * Remove cluster.
+         * @param {mongo.ObjectId|String} clusterId - The cluster id for remove.
+         * @returns {Promise.<{rowsAffected}>} - The number of affected rows.
+         */
+        static remove(clusterId) {
+
+        }
+
+        /**
+         * Remove all clusters by user.
+         * @param {mongo.ObjectId|String} userId - The user id that own cluster.
+         * @param {Boolean} demo - The flag indicates that need lookup in demo space.
+         * @returns {Promise.<{rowsAffected}>} - The number of affected rows.
+         */
+        static removeAll(userId, demo) {
+
+        }
+    }
+
+    return ClusterService;
+};

http://git-wip-us.apache.org/repos/asf/ignite/blob/bfdbfd0d/modules/web-console/src/main/js/serve/services/domain.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/serve/services/domain.js b/modules/web-console/src/main/js/serve/services/domain.js
new file mode 100644
index 0000000..513df07
--- /dev/null
+++ b/modules/web-console/src/main/js/serve/services/domain.js
@@ -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.
+ */
+
+'use strict';
+
+// Fire me up!
+
+module.exports = {
+    implements: 'services/domain',
+    inject: ['require(lodash)', 'mongo', 'services/space', 'errors']
+};
+
+module.exports.factory = (_, mongo, spaceService, errors) => {
+    class DomainService {
+        /**
+         * Create or update domain.
+         * @param {Object} domain - The domain
+         * @returns {Promise.<mongo.ObjectId>} that resolves domain id of merge operation.
+         */
+        static merge(domain) {
+
+        }
+
+        /**
+         * Batch merging domains.
+         * @param {mongo.DomainModel[]} domains
+         */
+        static batchMerge(domains) {
+
+        }
+
+        /**
+         * Get domain and linked objects by user.
+         * @param {mongo.ObjectId|String} userId - The user id that own domain.
+         * @param {Boolean} demo - The flag indicates that need lookup in demo space.
+         * @returns {Promise.<[mongo.Cache[], mongo.Cluster[], mongo.DomainModel[], mongo.Space[]]>}
- contains requested caches and array of linked objects: clusters, domains, spaces.
+         */
+        static listByUser(userId, demo) {
+
+        }
+
+        /**
+         * Remove domain.
+         * @param {mongo.ObjectId|String} domain_ID - The domain id for remove.
+         * @returns {Promise.<{rowsAffected}>} - The number of affected rows.
+         */
+        static remove(domain_ID) {
+
+        }
+
+        /**
+         * Remove all domains by user.
+         * @param {mongo.ObjectId|String} userId - The user id that own domain.
+         * @param {Boolean} demo - The flag indicates that need lookup in demo space.
+         * @returns {Promise.<{rowsAffected}>} - The number of affected rows.
+         */
+        static removeAll(userId, demo) {
+
+        }
+    }
+
+    return DomainService;
+};

http://git-wip-us.apache.org/repos/asf/ignite/blob/bfdbfd0d/modules/web-console/src/main/js/serve/services/igfs.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/serve/services/igfs.js b/modules/web-console/src/main/js/serve/services/igfs.js
new file mode 100644
index 0000000..b98e57f
--- /dev/null
+++ b/modules/web-console/src/main/js/serve/services/igfs.js
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ */
+
+'use strict';
+
+// Fire me up!
+
+module.exports = {
+    implements: 'services/igfs',
+    inject: ['require(lodash)', 'mongo', 'services/space', 'errors']
+};
+
+module.exports.factory = (_, mongo, spaceService, errors) => {
+    class IgfsService {
+        /**
+         * Create or update IGFS.
+         * @param {Object} IGFS - The IGFS
+         * @returns {Promise.<mongo.ObjectId>} that resolves IGFS id of merge operation.
+         */
+        static merge(igfs) {
+
+        }
+
+        /**
+         * Get IGFS and linked objects by user.
+         * @param {mongo.ObjectId|String} userId - The user id that own IGFS.
+         * @param {Boolean} demo - The flag indicates that need lookup in demo space.
+         * @returns {Promise.<[mongo.Cache[], mongo.Cluster[], mongo.DomainModel[], mongo.Space[]]>}
- contains requested caches and array of linked objects: clusters, domains, spaces.
+         */
+        static listByUser(userId, demo) {
+
+        }
+
+        /**
+         * Remove IGFS.
+         * @param {mongo.ObjectId|String} igfsId - The IGFS id for remove.
+         * @returns {Promise.<{rowsAffected}>} - The number of affected rows.
+         */
+        static remove(igfsId) {
+
+        }
+
+        /**
+         * Remove all IGFSes by user.
+         * @param {mongo.ObjectId|String} userId - The user id that own IGFS.
+         * @param {Boolean} demo - The flag indicates that need lookup in demo space.
+         * @returns {Promise.<{rowsAffected}>} - The number of affected rows.
+         */
+        static removeAll(userId, demo) {
+
+        }
+    }
+
+    return IgfsService;
+};

http://git-wip-us.apache.org/repos/asf/ignite/blob/bfdbfd0d/modules/web-console/src/main/js/serve/services/mail.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/serve/services/mail.js b/modules/web-console/src/main/js/serve/services/mail.js
new file mode 100644
index 0000000..97581fc
--- /dev/null
+++ b/modules/web-console/src/main/js/serve/services/mail.js
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+'use strict';
+
+// Fire me up!
+
+module.exports = {
+    implements: 'services/mail',
+    inject: ['require(lodash)', 'mongo', 'services/space', 'errors']
+};
+
+module.exports.factory = (_, mongo, spaceService, errors) => {
+
+    // TODO extract here current send mail.
+    const send = () => {
+
+    };
+
+    class MailService {
+
+        /**
+         * Send email to user for password reset.
+         * @param user
+         * @param resetUrl
+         */
+        static emailUserResetLink(user, resetUrl) {
+
+        }
+
+        /**
+         * Send emait to user when it was deleted.
+         * @param user
+         */
+        static emailUserDeletion(user) {
+
+        }
+    }
+
+    return MailService;
+};

http://git-wip-us.apache.org/repos/asf/ignite/blob/bfdbfd0d/modules/web-console/src/main/js/serve/services/notebook.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/serve/services/notebook.js b/modules/web-console/src/main/js/serve/services/notebook.js
new file mode 100644
index 0000000..0b304c3
--- /dev/null
+++ b/modules/web-console/src/main/js/serve/services/notebook.js
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ */
+
+'use strict';
+
+// Fire me up!
+
+module.exports = {
+    implements: 'services/notebook',
+    inject: ['require(lodash)', 'mongo', 'services/space', 'errors']
+};
+
+module.exports.factory = (_, mongo, spaceService, errors) => {
+    class NotebookService {
+        /**
+         * Create or update Notebook.
+         * @param {Object} Notebook - The Notebook
+         * @returns {Promise.<mongo.ObjectId>} that resolves Notebook id of merge operation.
+         */
+        static merge(Notebook) {
+
+        }
+
+        /**
+         * Get all Notebooks by user.
+         * @param {mongo.ObjectId|String} userId - The user id that own Notebook.
+         * @param {Boolean} demo - The flag indicates that need lookup in demo space.
+         * @returns {Promise.<mongo.Notebook[]>} - contains requested notebooks
+         */
+        static listByUser(userId) {
+
+        }
+
+        /**
+         * Get one Notebook.
+         * @param {mongo.ObjectId|String} userId - The user id that own Notebook.
+         * @param {mongo.ObjectId|String} notebookId - The notebook id .
+         * @param {Boolean} demo - The flag indicates that need lookup in demo space.
+         * @returns {Promise.<mongo.Notebook[]>} - contains requested notebooks
+         */
+        static findFirstByUser(userId, notebookId) {
+
+        }
+
+        /**
+         * Remove Notebook.
+         * @param {mongo.ObjectId|String} notebookId - The Notebook id for remove.
+         * @returns {Promise.<{rowsAffected}>} - The number of affected rows.
+         */
+        static remove(notebookId) {
+
+        }
+
+    }
+
+    return NotebookService;
+};

http://git-wip-us.apache.org/repos/asf/ignite/blob/bfdbfd0d/modules/web-console/src/main/js/serve/services/session.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/serve/services/session.js b/modules/web-console/src/main/js/serve/services/session.js
new file mode 100644
index 0000000..33c1fa1
--- /dev/null
+++ b/modules/web-console/src/main/js/serve/services/session.js
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+
+'use strict';
+
+// Fire me up!
+
+module.exports = {
+    implements: 'services/session',
+    inject: ['require(lodash)', 'mongo', 'services/space', 'errors']
+};
+
+module.exports.factory = (_, mongo, spaceService, errors) => {
+    class SessionService {
+        /**
+         * Become user.
+         * @param {Session} session - current session of user.
+         * @param {mongo.ObjectId|String} viewedUserId - id of user to become.
+         */
+        static become(session, viewedUserId) {
+
+        }
+
+        /**
+         * Revert to your identity.
+         */
+        static revert(session) {
+
+        }
+    }
+
+    return SessionService;
+};


Mime
View raw message