123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- /**
- * 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.zookeeper;
- import java.util.ArrayList;
- import java.util.Collections;
- import org.apache.zookeeper.data.ACL;
- import org.apache.zookeeper.data.Id;
- public class ZooDefs {
- public interface OpCode {
- public final int notification = 0;
- public final int create = 1;
- public final int delete = 2;
- public final int exists = 3;
- public final int getData = 4;
- public final int setData = 5;
- public final int getACL = 6;
- public final int setACL = 7;
- public final int getChildren = 8;
-
- public final int sync = 9;
- public final int ping = 11;
- public final int auth = 100;
- public final int createSession = -10;
- public final int closeSession = -11;
- public final int error = -1;
- }
- public interface CreateFlags {
- int EPHEMERAL = 1 << 0;
- int SEQUENCE = 1 << 1;
- }
- public interface Perms {
- int READ = 1 << 0;
- int WRITE = 1 << 1;
- int CREATE = 1 << 2;
- int DELETE = 1 << 3;
- int ADMIN = 1 << 4;
- int ALL = READ | WRITE | CREATE | DELETE;
- }
- public interface Ids {
- /**
- * This Id represents anyone.
- */
- public final Id ANYONE_ID_UNSAFE = new Id("world", "anyone");
- /**
- * This Id is only usable to set ACLs. It will get substituted with the
- * Id's the client authenticated with.
- */
- public final Id AUTH_IDS = new Id("auth", "");
- /**
- * This is a completely open ACL with the exception of ADMIN permission.
- */
- public final ArrayList<ACL> OPEN_ACL_UNSAFE = new ArrayList<ACL>(
- Collections.singletonList(new ACL(Perms.ALL, ANYONE_ID_UNSAFE)));
- /**
- * This ACL gives the creators authentication id's all permissions.
- */
- public final ArrayList<ACL> CREATOR_ALL_ACL = new ArrayList<ACL>(
- Collections.singletonList(new ACL(Perms.ALL | Perms.ADMIN,
- AUTH_IDS)));
- /**
- * This ACL gives the world the ability to read.
- */
- public final ArrayList<ACL> READ_ACL_UNSAFE = new ArrayList<ACL>(
- Collections
- .singletonList(new ACL(Perms.READ, ANYONE_ID_UNSAFE)));
- }
- final public static String[] opNames = { "notification", "create",
- "delete", "exists", "getData", "setData", "getACL", "setACL",
- "getChildren", "getMaxChildren", "setMaxChildren", "ping" };
- }
|