No matter how you reached this page, you do not have sufficient privileges
22 |
Your action has been logged and our administrators have been notified about it
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | {% endblock %}
34 |
--------------------------------------------------------------------------------
/templates/registration/activation_email.txt:
--------------------------------------------------------------------------------
1 | {% load i18n %}{% url validate_email validation_key as validation_url %}{% blocktrans with full_name=user.get_full_name username=user.username email=user.email domain=site.domain %}You have registered for a new account.
2 |
3 | Username: {{ username }}
4 | E-mail: {{ email }}
5 |
6 | To proceed with with your account activation, you must first validate your email
7 | address. To do so, click on the following link or copy the address to your browser
8 | {% endblocktrans %}
9 |
10 | http://{{ site.domain }}{% url 'registration_activate' activation_key %}
11 |
12 | {% blocktrans %}
13 | The site's administrator will then be notified about your newly created account and
14 | proceed to approve it.
15 |
16 | You have {{ expiration_days }} days to validate your email address. If you fail to
17 | do so within the time limit, you will have to register again.
18 |
19 | Upon approval, you will receive a new email message.
20 | {% endblocktrans %}
21 |
--------------------------------------------------------------------------------
/contrib/fabric/utils/django.py:
--------------------------------------------------------------------------------
1 | from fabric.api import cd, run, prefix
2 | from utils.operations import try_to_execute
3 | from fabric.operations import sudo
4 |
5 |
6 | def collectstatic(path, venv=False):
7 | with cd(path):
8 | if venv:
9 | with prefix(venv):
10 | try_to_execute('./manage.py collectstatic --noinput')
11 | else:
12 | try_to_execute('./manage.py collectstatic --noinput')
13 |
14 |
15 | def clean_pyc(path):
16 | with cd(path):
17 | sudo('find -name "*.pyc" -delete')
18 |
19 |
20 | def db_config(settings):
21 | # grep the database settings from settings.py
22 | database_settings = run(" grep -A10 '\DATABASES = {' %s | grep -E 'NAME|ENGINE|PASSWO|HOST|PORT|USER'" % settings)
23 | db_settings = {}
24 | for s in database_settings.split('\n'):
25 | s = s.strip().split(',')[0].split(':')
26 | db_settings.update({s[0].split('\'')[1]: s[1].split('\'')[1]})
27 | return db_settings
28 |
--------------------------------------------------------------------------------
/ganeti/urls/jobs.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*- vim:fileencoding=utf-8:
2 | # Copyright (C) 2010-2014 GRNET S.A.
3 | #
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program. If not, see .
16 | #
17 |
18 | from django.conf.urls import url
19 | from ganeti import views
20 |
21 | urlpatterns = [
22 | url(r'^json/$', views.jobs_index_json, name="jobs_json"),
23 | url(r'^$', views.jobs, name="jobs"),
24 | ]
25 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | ## dependencies for the ganetimgr project
2 | django==1.11
3 | # we target the latest LTS release
4 | gevent==1.1.2
5 | # gevent is used to pool cluster RAPI communication
6 | django-registration-redux==2.4
7 | # used for our registration workflow
8 | paramiko==2.0.0
9 | # used for user SSH key management
10 | python-daemon==2.1.2
11 | # used by watcher
12 | setproctitle==1.1.10
13 | # used by watcher to set it's process name
14 | pycurl==7.43.0
15 | # depenency for ganeti client library
16 | django-nocaptcha-recaptcha==0.0.20
17 | # used in the registration form
18 | ipaddr==2.1.11
19 | # used to calculate Instance ipv6addresses
20 | beautifulsoup4==4.5.3
21 | # used by the image autodiscovery mechanism
22 | requests==2.12.4
23 | # used by the image autodiscovery mechanism
24 | beanstalkc==0.4.0
25 | # used to pass messages between watcher and django
26 | django-redis-cache==1.7.1
27 | # used to cache cluster nodes/instances info
28 | pyyaml==3.12
29 | # used by beanstalkc
30 | django-jsonfield==1.0.1
31 |
--------------------------------------------------------------------------------
/auditlog/urls.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*- vim:fileencoding=utf-8:
2 | # Copyright (C) 2010-2014 GRNET S.A.
3 | #
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program. If not, see .
16 | #
17 |
18 | from django.conf.urls import url
19 | from auditlog import views
20 |
21 | urlpatterns = [
22 | url(r'^$', views.auditlog, name='auditlog'),
23 | url(r'^json/$', views.auditlog_json, name='auditlog_json'),
24 | ]
25 |
--------------------------------------------------------------------------------
/templates/notifications/create_ajax.html:
--------------------------------------------------------------------------------
1 | {% load i18n %}
2 | {% block extrahead %}
3 |
4 | {% include "notifications/create_script.html" %}
5 |
34 | {% endblock %}
35 |
36 | {% block content %}
37 | {% include "notifications/create_body.html" %}
38 | {% endblock %}
39 |
--------------------------------------------------------------------------------
/static/noVNC/docs/LICENSE.zlib:
--------------------------------------------------------------------------------
1 | Copyright (c) ,
2 | All rights reserved.
3 |
4 | This software is provided 'as-is', without any express
5 | or implied warranty. In no event will the authors be
6 | held liable for any damages arising from the use of
7 | this software.
8 |
9 | Permission is granted to anyone to use this software
10 | for any purpose, including commercial applications,
11 | and to alter it and redistribute it freely, subject to
12 | the following restrictions:
13 |
14 | 1. The origin of this software must not be
15 | misrepresented; you must not claim that you
16 | wrote the original software. If you use this
17 | software in a product, an acknowledgment in
18 | the product documentation would be appreciated
19 | but is not required.
20 |
21 | 2. Altered source versions must be plainly marked
22 | as such, and must not be misrepresented as
23 | being the original software.
24 |
25 | 3. This notice may not be removed or altered from
26 | any source distribution.
27 |
28 |
--------------------------------------------------------------------------------
/templates/500.html:
--------------------------------------------------------------------------------
1 | {% extends "base.html" %}
2 | {% load i18n %}
3 |
4 | {% block title %}Ohhhh a 500 - Internal Error{% endblock %}
5 | {% block navbars %}{% endblock %}
6 | {% block blockcontainer %}
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | {% trans 'Internal error' %}
17 |
18 |
19 |
20 |
{% trans 'Administrators have been notified about this problem. We apologize for the inconvenience.' %}
31 | {% endif %}
32 | {% endblock %}
33 |
34 |
--------------------------------------------------------------------------------
/ganeti/views/discovery.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*- vim:fileencoding=utf-8:
2 | # Copyright (C) 2010-2014 GRNET S.A.
3 | #
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program. If not, see .
16 | #
17 | from ganeti.decorators import ajax_required
18 | from django.http import HttpResponse
19 | from ganeti.utils import operating_systems
20 |
21 |
22 | @ajax_required
23 | def get_operating_systems(request):
24 | return HttpResponse(operating_systems())
25 |
26 |
--------------------------------------------------------------------------------
/ganeti/urls/nodegroup.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*- vim:fileencoding=utf-8:
2 | # Copyright (C) 2010-2014 GRNET S.A.
3 | #
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program. If not, see .
16 | #
17 |
18 | from django.conf.urls import url
19 | from ganeti import views
20 |
21 | urlpatterns = [
22 | url(r'^fromnet/$', views.get_nodegroups_fromnet, name='ng_from_net'),
23 | url(r'^cluster/$', views.get_cluster_node_group_stack, name='cluster_ng_stack'),
24 |
25 | ]
26 |
--------------------------------------------------------------------------------
/templates/registration/validation_expired.html:
--------------------------------------------------------------------------------
1 | {% extends "base.html" %}
2 | {% load i18n %}
3 | {% block title %}{% trans "Activation Expired" %}{% endblock %}
4 | {% block brcrmb_container %}{% endblock %}
5 |
6 | {% block blockcontainer %}
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | {% trans "Activation Expired" %}
17 |
18 |
19 |
20 |
{% trans "Seems that you failed to activate your account within your given time limit." %}
21 |
{% trans "Your account has been deleted. You need to register again." %}
{% trans "An email has been sent to the address you specified during registration" %}
21 |
{% trans "To proceed with your registration follow the instructions provided in the email" %}
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | {% endblock %}
33 |
--------------------------------------------------------------------------------
/ganeti/templatetags/truncatedchars.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*- vim:fileencoding=utf-8:
2 | # Copyright (C) 2010-2014 GRNET S.A.
3 | #
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program. If not, see .
16 | #
17 |
18 | from django import template
19 |
20 | register = template.Library()
21 |
22 | @register.filter
23 | # truncate after a certain number of characters
24 | def truncchar(value, arg):
25 | if len(value) < arg:
26 | return value
27 | else:
28 | return value[:arg] + '...'
29 |
--------------------------------------------------------------------------------
/ganeti/templatetags/days_since.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*- vim:fileencoding=utf-8:
2 | # Copyright (C) 2010-2014 GRNET S.A.
3 | #
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program. If not, see .
16 | #
17 |
18 | from django import template
19 | register = template.Library()
20 |
21 | import datetime
22 |
23 | @register.filter(name='days_since')
24 | def days_since(value):
25 | since = 0
26 | try:
27 | since = (datetime.datetime.now() - value).days
28 | except:
29 | pass
30 | return since
--------------------------------------------------------------------------------
/accounts/admin.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*- vim:fileencoding=utf-8:
2 | # Copyright (C) 2010-2014 GRNET S.A.
3 | #
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program. If not, see .
16 | #
17 |
18 |
19 | from django.contrib import admin
20 | from accounts.models import UserProfile
21 | from registration.models import RegistrationProfile
22 |
23 |
24 | admin.site.register(UserProfile)
25 | # This unregisters the default RegistrationProfile so that we
26 | # can use our own
27 | admin.site.unregister(RegistrationProfile)
28 |
--------------------------------------------------------------------------------
/templates/registration/activation_complete_admin_pending.html:
--------------------------------------------------------------------------------
1 | {% extends "base.html" %}
2 | {% load i18n %}
3 | {% block title %}{% trans "Activation Complete" %}{% endblock %}
4 | {% block brcrmb_container %}{% endblock %}
5 | {% block blockcontainer %}
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | {% trans "Activation Status" %}
16 |
17 |
18 |
19 |
{% trans "Account"%} {{account}} {% trans "succesfully activated" %}
20 |
{% trans "Your account will be approved by an administrator and you will be notified via email"%}
41 | {% endblock %}
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/manage.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*- vim:fileencoding=utf-8:
3 | # Copyright (C) 2010-2014 GRNET S.A.
4 | #
5 | # This program is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # This program is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License
16 | # along with this program. If not, see .
17 | #
18 |
19 | import os
20 | import sys
21 |
22 | if __name__ == "__main__":
23 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ganetimgr.settings")
24 |
25 | from gevent import monkey
26 | monkey.patch_all()
27 | from django.core.management import execute_from_command_line
28 |
29 | execute_from_command_line(sys.argv)
30 |
--------------------------------------------------------------------------------
/ganeti/templatetags/disksizes.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*- vim:fileencoding=utf-8:
2 | # Copyright (C) 2010-2014 GRNET S.A.
3 | #
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program. If not, see .
16 | #
17 |
18 | from django import template
19 | from django.template.defaultfilters import filesizeformat
20 |
21 | register = template.Library()
22 |
23 | @register.filter
24 | def disksizes(value):
25 | return [filesizeformat(v * 1024**2) for v in value]
26 |
27 | @register.filter
28 | def memsize(value):
29 | return filesizeformat(value * 1024**2)
30 |
--------------------------------------------------------------------------------
/contrib/vnc_javasrc/index.html:
--------------------------------------------------------------------------------
1 |
18 |
19 |
20 |
21 | TightVNC desktop
22 |
23 |
27 |
28 | TightVNC site
29 |
30 |
--------------------------------------------------------------------------------
/notifications/urls.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*- vim:fileencoding=utf-8:
2 | # Copyright (C) 2010-2014 GRNET S.A.
3 | #
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program. If not, see .
16 | #
17 |
18 | from django.conf.urls import url
19 | from notifications import views
20 |
21 | urlpatterns = [
22 | url(r'^usergrps/$', views.get_user_group_list, name="usergroups"),
23 | url(r'^(?P[^/]+)/$', views.notify, name="notify"),
24 | url(r'^archive/(?P\w+)/$', views.archive, name="notification-details"),
25 | url(r'^$', views.notify, name="notify"),
26 | ]
27 |
--------------------------------------------------------------------------------
/ganeti/templatetags/applicationstatus.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*- vim:fileencoding=utf-8:
2 | # Copyright (C) 2010-2014 GRNET S.A.
3 | #
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program. If not, see .
16 | #
17 |
18 | from django import template
19 |
20 | register = template.Library()
21 |
22 |
23 | @register.filter
24 | def appstatus(value):
25 | if value == "pending":
26 | return "info"
27 | if value == "approved":
28 | return "success"
29 | if value == "failed":
30 | return "important"
31 | if value == "refused":
32 | return "warning"
33 | return "info"
34 |
--------------------------------------------------------------------------------
/stats/urls.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*- vim:fileencoding=utf-8:
2 | # Copyright (C) 2010-2014 GRNET S.A.
3 | #
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program. If not, see .
16 | #
17 |
18 | from django.conf.urls import url
19 | from stats import views
20 |
21 | urlpatterns = [
22 | url(r'^applications/?', views.stats_ajax_applications, name="stats_ajax_apps"),
23 | url(r'^instances/?', views.stats_ajax_instances, name="stats_ajax_instances"),
24 | url(r'^vms_cluster/(?P[^/]+)/?', views.stats_ajax_vms_per_cluster, name="stats_ajax_vms_pc"),
25 | url(r'^$', views.stats, name="stats"),
26 | ]
27 |
--------------------------------------------------------------------------------
/auditlog/admin.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*- vim:fileencoding=utf-8:
2 | # Copyright (C) 2010-2014 GRNET S.A.
3 | #
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program. If not, see .
16 | #
17 |
18 | from django.contrib import admin
19 | from models import AuditEntry
20 |
21 |
22 | class AuditEntryAdmin(admin.ModelAdmin):
23 | list_display = (
24 | 'requester',
25 | 'action',
26 | 'instance',
27 | 'cluster',
28 | 'job_id',
29 | 'last_updated'
30 | )
31 | list_filter = ('cluster', 'action', 'last_updated')
32 |
33 | admin.site.register(AuditEntry, AuditEntryAdmin)
34 |
35 |
36 |
--------------------------------------------------------------------------------
/notifications/migrations/0001_initial.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from __future__ import unicode_literals
3 |
4 | from django.db import models, migrations
5 | from django.conf import settings
6 |
7 |
8 | class Migration(migrations.Migration):
9 |
10 | dependencies = [
11 | migrations.swappable_dependency(settings.AUTH_USER_MODEL),
12 | ]
13 |
14 | operations = [
15 | migrations.CreateModel(
16 | name='NotificationArchive',
17 | fields=[
18 | ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
19 | ('subject', models.CharField(max_length=255)),
20 | ('message', models.TextField()),
21 | ('date', models.DateTimeField(auto_now_add=True)),
22 | ('recipients', models.ManyToManyField(related_name='notifications', to=settings.AUTH_USER_MODEL)),
23 | ('sender', models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True)),
24 | ],
25 | options={
26 | 'ordering': ['-date'],
27 | 'permissions': (('can_view_notif', 'Can view all notifications'),),
28 | },
29 | ),
30 | ]
31 |
--------------------------------------------------------------------------------
/ganetimgr/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for ganetimgrw project.
3 |
4 | This module contains the WSGI application used by Django's development server
5 | and any production WSGI deployments. It should expose a module-level variable
6 | named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
7 | this application via the ``WSGI_APPLICATION`` setting.
8 |
9 | Usually you will have the standard Django WSGI application here, but it also
10 | might make sense to replace the whole Django WSGI application with a custom one
11 | that later delegates to the Django one. For example, you could introduce WSGI
12 | middleware here, or combine a Django application with an application of another
13 | framework.
14 |
15 | """
16 | import os
17 |
18 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ganetimgr.settings")
19 |
20 | # This application object is used by any WSGI server configured to use this
21 | # file. This includes Django's development server, if the WSGI_APPLICATION
22 | # setting points here.
23 | from django.core.wsgi import get_wsgi_application
24 | application = get_wsgi_application()
25 |
26 | # Apply WSGI middleware here.
27 | # from helloworld.wsgi import HelloWorldApplication
28 | # application = HelloWorldApplication(application)
29 |
--------------------------------------------------------------------------------
/templates/instances/emails/instance_created_mail.txt:
--------------------------------------------------------------------------------
1 | Η εικονική μηχανή με όνομα {{ application.hostname }} δημιουργήθηκε.
2 |
3 | Μπορείτε να τη χειριστείτε και να δείτε τα στοιχεία της στην ακόλουθη
4 | διεύθυνση:
5 | {{instance_url}}
6 |
7 | {% if application.admin_comments %}Σχόλια διαχειριστή:
8 | {{ application.admin_comments }}
9 | {% endif %}
10 |
11 | {% if reviewer %}Εγκρίθηκε από: {{reviewer}}
12 | {% endif %}
13 |
14 | Για περισσότερες πληροφορίες για την εικονική μηχανή σας ή για οποιοιδήποτε
15 | άλλο αίτημα αφορά την υπηρεσία, μπορείτε να επικοινωνήσετε με το Helpdesk του
16 | {{ BRANDING.SERVICE_PROVIDED_BY.NAME }}.
17 |
18 | -----------------------------------------------------------------------------
19 |
20 | The virtual machine name {{ application.hostname }} has been created.
21 |
22 | You can manipulate and view the data at the following address:
23 | {{instance_url}}
24 |
25 | {% if application.admin_comments %}Comments from the administrator:
26 | {{ application.admin_comments }}
27 | {% endif %}
28 |
29 | {% if reviewer %}Approved by: {{reviewer}}
30 | {% endif %}
31 | For more information on the virtual machine or any
32 | other request regarding the service, you can contact the {{ BRANDING.SERVICE_PROVIDED_BY.NAME }} Helpdesk.
33 |
--------------------------------------------------------------------------------
/contrib/vnc_javasrc/MemInStream.java:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
2 | *
3 | * This is free software; you can redistribute it and/or modify
4 | * it under the terms of the GNU General Public License as published by
5 | * the Free Software Foundation; either version 2 of the License, or
6 | * (at your option) any later version.
7 | *
8 | * This software is distributed in the hope that it will be useful,
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | * GNU General Public License for more details.
12 | *
13 | * You should have received a copy of the GNU General Public License
14 | * along with this software; if not, write to the Free Software
15 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16 | * USA.
17 | */
18 |
19 | public class MemInStream extends InStream {
20 |
21 | public MemInStream(byte[] data, int offset, int len) {
22 | b = data;
23 | ptr = offset;
24 | end = offset + len;
25 | }
26 |
27 | public int pos() { return ptr; }
28 |
29 | protected int overrun(int itemSize, int nItems) throws Exception {
30 | throw new Exception("MemInStream overrun: end of stream");
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/ganeti/urls/graphs.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*- vim:fileencoding=utf-8:
2 | # Copyright (C) 2010-2014 GRNET S.A.
3 | #
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program. If not, see .
16 | #
17 |
18 | from django.conf.urls import url
19 | from ganeti import views
20 |
21 | urlpatterns = [
22 | url(r'^(?P[^/]+)/(?P[^/]+)/(?P[^/]+)(/(?P[\\:\w\d\s\.+-]+),(?P[\\:\w\d\s\.+-]+))?(/(?Peth\d+))?$', views.graph, name='graph'),
23 | url(r'^all/$', views.cluster_nodes_graphs, name="cluster-get-nodes-graphs"),
24 | url(r'^(?P[^/]+)/instances/$', views.cluster_nodes_graphs, name="cluster-get-nodes-graphs"),
25 | ]
26 |
--------------------------------------------------------------------------------
/apply/utils.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*- vim:fileencoding=utf-8:
2 | # Copyright (C) 2010-2014 GRNET S.A.
3 | #
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program. If not, see .
16 | #
17 | from ganeti.models import InstanceAction
18 |
19 |
20 | def check_mail_change_pending(user):
21 | actions = []
22 | pending_actions = InstanceAction.objects.filter(applicant=user, action=4)
23 | for pending in pending_actions:
24 | if pending.activation_key_expired():
25 | continue
26 | actions.append(pending)
27 | if len(actions) == 0:
28 | return False
29 | elif len(actions) == 1:
30 | return True
31 | else:
32 | return False
33 |
34 |
--------------------------------------------------------------------------------
/auditlog/migrations/0001_initial.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from __future__ import unicode_literals
3 |
4 | from django.db import models, migrations
5 | from django.conf import settings
6 |
7 |
8 | class Migration(migrations.Migration):
9 |
10 | dependencies = [
11 | migrations.swappable_dependency(settings.AUTH_USER_MODEL),
12 | ]
13 |
14 | operations = [
15 | migrations.CreateModel(
16 | name='AuditEntry',
17 | fields=[
18 | ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
19 | ('ipaddress', models.CharField(max_length=255, null=True, blank=True)),
20 | ('action', models.CharField(max_length=255)),
21 | ('instance', models.CharField(max_length=255)),
22 | ('cluster', models.CharField(max_length=50)),
23 | ('job_id', models.IntegerField(null=True, blank=True)),
24 | ('recorded', models.DateTimeField(auto_now_add=True)),
25 | ('last_updated', models.DateTimeField(auto_now=True)),
26 | ('is_authorized', models.BooleanField(default=True)),
27 | ('requester', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
28 | ],
29 | ),
30 | ]
31 |
--------------------------------------------------------------------------------
/templates/instances/emails/reinstall_mail.txt:
--------------------------------------------------------------------------------
1 | {% load i18n %}{% blocktrans with username=user.username %}User {{ user.username }} {% endblocktrans%}{% if user.first_name or user.last_name %}({{user.first_name}} {{user.last_name}}){% endif %} {% trans "has made the following request" %}:
2 | ------------------------
3 |
4 | {% if action == 'reinstall' %}{% trans "Reinstall" %}:{% endif %}{% if action == 'destroy' %}{% trans "Delete" %}:{% endif %}{% if action == 'rename' %}{% trans "Rename" %}:{% endif %}{% if action == 'mailchange' %}{% trans "Change email" %}{% endif %}
5 | {% if action == 'mailchange' %}{% trans "New email" %}: {{action_value}}{% endif %}{% if action != 'mailchange' %}
6 | {{instance}} {% if action == 'rename' %}{% trans "to" %} {{action_value}}{% endif %}{% if action != 'rename' %}
7 | {% trans "WARNING! The above action will" %} {% if action == 'reinstall' %}{% trans "delete your data" %}{% if operating_system %} {% trans "and install" %} {{ operating_system }}{% endif %}{% endif %}{% if action == 'destroy' %}{% trans "delete your virtual machine" %}{% endif %}. {% blocktrans %}Make sure you take backups of any data you need.
8 | WARNING! Once you start the process, it cannot be undone. {% endblocktrans %}
9 | {% endif %}{% endif %}
10 | {% blocktrans %}To continue, please visit {{url}}{% endblocktrans %}
11 |
--------------------------------------------------------------------------------
/middleware/ForceLogout.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*- vim:fileencoding=utf-8:
2 | # Copyright (C) 2010-2014 GRNET S.A.
3 | #
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program. If not, see .
16 | #
17 |
18 | from django.contrib.auth import logout
19 |
20 |
21 | class ForceLogoutMiddleware(object):
22 | def process_request(self, request):
23 | if (
24 | request.user.is_authenticated() and
25 | request.user.userprofile.force_logout_date and
26 | (
27 | 'LAST_LOGIN_DATE' not in request.session or
28 | request.session['LAST_LOGIN_DATE'] < request.user.userprofile.force_logout_date
29 | )
30 | ):
31 | logout(request)
32 |
--------------------------------------------------------------------------------
/contrib/fabric/utils/services.py:
--------------------------------------------------------------------------------
1 | from fabric.operations import sudo
2 |
3 |
4 | def stop_beanstalk():
5 | sudo('service beanstalkd stop')
6 |
7 |
8 | def start_beanstalk():
9 | sudo('service beanstalkd start')
10 |
11 |
12 | def restart_beanstalk():
13 | stop_beanstalk()
14 | start_beanstalk()
15 |
16 |
17 | def stop_redis():
18 | sudo('service redis-server stop')
19 |
20 |
21 | def start_redis():
22 | sudo('service redis-server start')
23 |
24 |
25 | def restart_redis():
26 | stop_redis()
27 | start_redis()
28 |
29 |
30 | def stop_nginx():
31 | sudo('/etc/init.d/nginx stop')
32 |
33 |
34 | def start_nginx():
35 | sudo('/etc/init.d/nginx start')
36 |
37 |
38 | def restart_nginx():
39 | stop_nginx()
40 | start_nginx()
41 |
42 |
43 | def stop_gunicorn():
44 | sudo('/etc/init.d/gunicorn stop')
45 |
46 |
47 | def start_gunicorn(app=None):
48 | sudo('/etc/init.d/gunicorn start %s' % (app or ''))
49 |
50 |
51 | def restart_gunicorn(app=None):
52 | stop_gunicorn()
53 | start_gunicorn(app)
54 |
55 |
56 | def stop_uwsgi(app=None):
57 | sudo('/etc/init.d/uwsgi stop %s' % (app or ''))
58 |
59 |
60 | def start_uwsgi(app=None):
61 | sudo('/etc/init.d/uwsgi stop %s' % (app or ''))
62 |
63 |
64 | def restart_uwsgi(app=None):
65 | stop_uwsgi(app)
66 | start_uwsgi(app)
67 |
--------------------------------------------------------------------------------
/contrib/jquery-ui/jquery.effects.transfer.js:
--------------------------------------------------------------------------------
1 | /*
2 | * jQuery UI Effects Transfer @VERSION
3 | *
4 | * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
5 | * Dual licensed under the MIT or GPL Version 2 licenses.
6 | * http://jquery.org/license
7 | *
8 | * http://docs.jquery.com/UI/Effects/Transfer
9 | *
10 | * Depends:
11 | * jquery.effects.core.js
12 | */
13 | (function( $, undefined ) {
14 |
15 | $.effects.transfer = function(o) {
16 | return this.queue(function() {
17 | var elem = $(this),
18 | target = $(o.options.to),
19 | endPosition = target.offset(),
20 | animation = {
21 | top: endPosition.top,
22 | left: endPosition.left,
23 | height: target.innerHeight(),
24 | width: target.innerWidth()
25 | },
26 | startPosition = elem.offset(),
27 | transfer = $('')
28 | .appendTo(document.body)
29 | .addClass(o.options.className)
30 | .css({
31 | top: startPosition.top,
32 | left: startPosition.left,
33 | height: elem.innerHeight(),
34 | width: elem.innerWidth(),
35 | position: 'absolute'
36 | })
37 | .animate(animation, o.duration, o.options.easing, function() {
38 | transfer.remove();
39 | (o.callback && o.callback.apply(elem[0], arguments));
40 | elem.dequeue();
41 | });
42 | });
43 | };
44 |
45 | })(jQuery);
46 |
--------------------------------------------------------------------------------
/ganeti/templatetags/bootstrappercent.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*- vim:fileencoding=utf-8:
2 | # Copyright (C) 2010-2014 GRNET S.A.
3 | #
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program. If not, see .
16 | #
17 |
18 | from django import template
19 |
20 | register = template.Library()
21 |
22 |
23 | @register.filter
24 | def perctobootstrap(value):
25 | if value < 50:
26 | return "success"
27 | if value >= 50 and value < 80:
28 | return "warning"
29 | if value >= 80:
30 | return "danger"
31 |
32 |
33 | @register.filter
34 | def perctobootstrapbadge(value):
35 | if value < 50:
36 | return "success"
37 | if value >= 50 and value < 80:
38 | return "warning"
39 | if value >= 80:
40 | return "important"
41 |
--------------------------------------------------------------------------------
/contrib/fabric/utils/git.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | from datetime import datetime
4 |
5 | from fabric.api import cd, run, abort
6 | from fabric.contrib.files import exists
7 | from fabric.operations import sudo
8 |
9 |
10 | def get_new_version(project_name, target, repository, tag):
11 | '''
12 | Fetches selected tag and puts it under the selected
13 | directory
14 | '''
15 | dir_name = '%s-%s' % (project_name, datetime.today().strftime('%Y%m%d%H%M'))
16 | with cd('/tmp'):
17 | # remove junk dirs
18 | if exists(project_name):
19 | run('rm -rf %s' % project_name)
20 | if exists(dir_name):
21 | run('rm -rf %s' % dir_name)
22 | # fresh clone
23 | run('git clone %s --quiet' % repository)
24 | with cd(project_name):
25 | try:
26 | # archive tag
27 | run('git archive --format=tar --prefix=%s/ %s | (cd /tmp/ && tar xf -) ' % (dir_name, tag))
28 | except:
29 | abort('Make sure %s exists in the repository.' % tag)
30 | # rm cloned code
31 | run('rm -rf %s' % project_name)
32 | # move into the proper dir
33 | if exists(os.path.join(target, dir_name)):
34 | sudo('rm -r %s' % os.path.join(target, dir_name))
35 | sudo('mv %s %s' % (dir_name, target))
36 | return os.path.join(target, dir_name)
37 |
--------------------------------------------------------------------------------
/contrib/vnc_javasrc/SocketFactory.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2002 HorizonLive.com, Inc. All Rights Reserved.
3 | //
4 | // This is free software; you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation; either version 2 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This software is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this software; if not, write to the Free Software
16 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17 | // USA.
18 | //
19 |
20 | //
21 | // SocketFactory.java describes an interface used to substitute the
22 | // standard Socket class by its alternative implementations.
23 | //
24 |
25 | import java.applet.*;
26 | import java.net.*;
27 | import java.io.*;
28 |
29 | public interface SocketFactory {
30 |
31 | public Socket createSocket(String host, int port, Applet applet)
32 | throws IOException;
33 |
34 | public Socket createSocket(String host, int port, String[] args)
35 | throws IOException;
36 | }
37 |
--------------------------------------------------------------------------------
/static/noVNC/docs/LICENSE.BSD-2-Clause:
--------------------------------------------------------------------------------
1 | Copyright (c) ,
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | notice, this list of conditions and the following disclaimer in the
11 | documentation and/or other materials provided with the distribution.
12 |
13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
17 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 |
--------------------------------------------------------------------------------
/apply/urls/application.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*- vim:fileencoding=utf-8:
2 | # Copyright (C) 2010-2014 GRNET S.A.
3 | #
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program. If not, see .
16 | #
17 |
18 | from django.conf.urls import url
19 | from apply import views
20 |
21 | urlpatterns = [
22 | url(r'^apply/?$', views.apply, name="apply"),
23 | url(r'^list/?$', views.application_list, name="application-list"),
24 | # this url is accessible only if a superuser tries to create
25 | # an instance by himself
26 | url(r'^save/', views.review_application, name="application-save"),
27 | url(r'^(?P\d+)/review/$', views.review_application, name="application-review"),
28 | url(r'^(?P\d+)/(?P\w+)/ssh_keys', views.instance_ssh_keys, name="instance-ssh-keys"),
29 | ]
30 |
--------------------------------------------------------------------------------
/contrib/jquery-ui/jquery.effects.highlight.js:
--------------------------------------------------------------------------------
1 | /*
2 | * jQuery UI Effects Highlight @VERSION
3 | *
4 | * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
5 | * Dual licensed under the MIT or GPL Version 2 licenses.
6 | * http://jquery.org/license
7 | *
8 | * http://docs.jquery.com/UI/Effects/Highlight
9 | *
10 | * Depends:
11 | * jquery.effects.core.js
12 | */
13 | (function( $, undefined ) {
14 |
15 | $.effects.highlight = function(o) {
16 | return this.queue(function() {
17 | var elem = $(this),
18 | props = ['backgroundImage', 'backgroundColor', 'opacity'],
19 | mode = $.effects.setMode(elem, o.options.mode || 'show'),
20 | animation = {
21 | backgroundColor: elem.css('backgroundColor')
22 | };
23 |
24 | if (mode == 'hide') {
25 | animation.opacity = 0;
26 | }
27 |
28 | $.effects.save(elem, props);
29 | elem
30 | .show()
31 | .css({
32 | backgroundImage: 'none',
33 | backgroundColor: o.options.color || '#ffff99'
34 | })
35 | .animate(animation, {
36 | queue: false,
37 | duration: o.duration,
38 | easing: o.options.easing,
39 | complete: function() {
40 | (mode == 'hide' && elem.hide());
41 | $.effects.restore(elem, props);
42 | (mode == 'show' && !$.support.opacity && this.style.removeAttribute('filter'));
43 | (o.callback && o.callback.apply(this, arguments));
44 | elem.dequeue();
45 | }
46 | });
47 | });
48 | };
49 |
50 | })(jQuery);
51 |
--------------------------------------------------------------------------------
/templates/instances/vnc.html:
--------------------------------------------------------------------------------
1 | {% extends "base.html" %}
2 | {% load staticfiles %}
3 | {% load i18n %}
4 |
5 | {% block homepage %}class="active"{% endblock %}
6 |
7 | {% block homepagetop %}class="active"{% endblock %}
8 |
9 | {% block title %}{{ instance }} - {% trans "Console" %}{% endblock %}
10 |
11 | {% block crumbs %}
12 |
79 | {% endfor %}
80 | {% endif %}
81 |
82 |
--------------------------------------------------------------------------------
/contrib/vnc_javasrc/CapabilityInfo.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2003 Constantin Kaplinsky. All Rights Reserved.
3 | //
4 | // This is free software; you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation; either version 2 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This software is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this software; if not, write to the Free Software
16 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17 | // USA.
18 | //
19 |
20 | //
21 | // CapabilityInfo.java - A class to hold information about a
22 | // particular capability as used in the RFB protocol 3.130.
23 | //
24 |
25 | class CapabilityInfo {
26 |
27 | // Public methods
28 |
29 | public CapabilityInfo(int code,
30 | String vendorSignature,
31 | String nameSignature,
32 | String description) {
33 | this.code = code;
34 | this.vendorSignature = vendorSignature;
35 | this.nameSignature = nameSignature;
36 | this.description = description;
37 | enabled = false;
38 | }
39 |
40 | public CapabilityInfo(int code,
41 | byte[] vendorSignature,
42 | byte[] nameSignature) {
43 | this.code = code;
44 | this.vendorSignature = new String(vendorSignature);
45 | this.nameSignature = new String(nameSignature);
46 | this.description = null;
47 | enabled = false;
48 | }
49 |
50 | public int getCode() {
51 | return code;
52 | }
53 |
54 | public String getDescription() {
55 | return description;
56 | }
57 |
58 | public boolean isEnabled() {
59 | return enabled;
60 | }
61 |
62 | public void enable() {
63 | enabled = true;
64 | }
65 |
66 | public boolean equals(CapabilityInfo other) {
67 | return (other != null && this.code == other.code &&
68 | this.vendorSignature.equals(other.vendorSignature) &&
69 | this.nameSignature.equals(other.nameSignature));
70 | }
71 |
72 | public boolean enableIfEquals(CapabilityInfo other) {
73 | if (this.equals(other))
74 | enable();
75 |
76 | return isEnabled();
77 | }
78 |
79 | // Protected data
80 |
81 | protected int code;
82 | protected String vendorSignature;
83 | protected String nameSignature;
84 |
85 | protected String description;
86 | protected boolean enabled;
87 | }
88 |
--------------------------------------------------------------------------------